﻿using DLLPC.Utilities;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design.Serialization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace VisionCore
{
    public class ProcedureHelper_Exc : ProcedureHelper_EQ
    {
        
        public static void AxisRun(AxisHelper axis, ref bool runing, int runNo, double[] absPos, double VLow, double VHigh, double acc = 0.02, double dec = 0.02)
            {
            string sub_Axis = "";
            if (axis == Kernel.motion.CV1_TrackSW_Y)
            {
                sub_Axis = "入口CV1轨道切换Y轴";
            }
            else if (axis == Kernel.motion.CV2_TrackSW_Y)
            {
                sub_Axis = "入口CV2轨道切换Y轴";
            }
            else if (axis == Kernel.motion.CCD1_X)
            {
                sub_Axis = "检测CCD1-X轴";
            }
            else if (axis == Kernel.motion.CCD1_Y)
            {
                sub_Axis = "检测CCD1-Y轴";
            }
            else if (axis == Kernel.motion.CCD1_Z)
            {
                sub_Axis = "检测CCD1-Z轴";
            }
            else if (axis == Kernel.motion.CCD2_X)
            {
                sub_Axis = "检测CCD2-X轴";
            }
            else if (axis == Kernel.motion.CCD2_Y)
            {
                sub_Axis = "检测CCD2-Y轴";
            }
            else if (axis == Kernel.motion.CCD2_Z)
            {
                sub_Axis = "检测CCD2-Z轴";
            }
           
            else if (axis == Kernel.motion.CV1_Y)
            {
                sub_Axis = "入口1CV-定位Y轴";
            }
            else if (axis == Kernel.motion.CV2_Y)
            {
                sub_Axis = "入口2CV-定位Y轴";
            }
            else if (axis == Kernel.motion.Insp1_Y)
            {
                sub_Axis = "检测模组1-定位Y轴";
            }
            else if (axis == Kernel.motion.Insp2_Y)
            {
                sub_Axis = "检测模组2-定位Y轴";
            }
            else if (axis == Kernel.motion.Insp3_Y)
            {
                sub_Axis = "检测模组3-定位Y轴";
            }
            else if (axis == Kernel.motion.Insp4_Y)
            {
                sub_Axis = "检测模组4-定位Y轴";
            }
            else if (axis == Kernel.motion.CV1_Driver)
            {
                sub_Axis = "入料口1 CV";
            }
            else if (axis == Kernel.motion.CV2_Driver)
            {
                sub_Axis = "入料口2 CV";
            }
            else if (axis == Kernel.motion.Insp1_CV1) { sub_Axis = "检测模组1 CV1";}
            else if (axis == Kernel.motion.Insp1_CV2) { sub_Axis = "检测模组1 CV2"; }
            else if (axis == Kernel.motion.Insp2_CV1) { sub_Axis = "检测模组2 CV1"; }
            else if (axis == Kernel.motion.Insp2_CV2) { sub_Axis = "检测模组2 CV2"; }
            else if (axis == Kernel.motion.Insp3_CV1) { sub_Axis = "检测模组3 CV1"; }
            else if (axis == Kernel.motion.Insp3_CV2) { sub_Axis = "检测模组3 CV2"; }
            else if (axis == Kernel.motion.Insp4_CV1) { sub_Axis = "检测模组4 CV1"; }
            else if (axis == Kernel.motion.Insp4_CV2) { sub_Axis = "检测模组4 CV2"; }

            if (runNo > 0 && runNo < 21 && runing)
            {
                axis.AxisMoveAbs(absPos[runNo - 1], VLow, VHigh, acc, dec);
                runing = false;

                string str = string.Format("{0} 移动到 {1:F3} 触发", sub_Axis, absPos[runNo - 1]);
                LogMotionMsg(str);
            }
            else if(runNo == 21 && runing)
            {
                axis.AxisMoveRel(absPos[0], VLow, VHigh, acc, dec);
                runing = false;

                string str = string.Format("{0} 移动 {1:F3} 触发", sub_Axis, absPos[0]);
                LogMotionMsg(str);
            }
            else if (runNo == 22 && runing)
            {
                axis.AxisMoveRel(absPos[1], VLow, VHigh, acc, dec);
                runing = false;
                string str = string.Format("{0} 移动 {1:F3} 触发", sub_Axis, absPos[1]);
                LogMotionMsg(str);
            }
            else if (runNo == 100)
            {
                axis.AxisMoveVel(true, VLow, VHigh);
            }
            else if (runNo == 101)
            {
                axis.AxisMoveVel(false, VLow, VHigh);
            }
        }
        
        public static void SaveExcST()
        {
            ParameterHelper.ExcSTDAL.Save(ParameterHelper.ExcST);
        }
        public static void SaveExcTR()
        {
            ParameterHelper.ExcTRDAL.Save(ParameterHelper.ExcTR);
        }
        public static void SaveSortST()
        {
            ParameterHelper.SortSTDAL.Save(ParameterHelper.SortST);
        }
        public static void SaveSortSTNG()
        {
            ParameterHelper.SortSTDAL.Save(ParameterHelper.SortSTNG);
        }
        public static void SaveLDTR1()
        {
            ParameterHelper.LDTR1DAL.Save(ParameterHelper.LDTR1);
        }
        public static void SaveLDTR2()
        {
            ParameterHelper.LDTR2DAL.Save(ParameterHelper.LDTR2);
        }
        public static void SaveLaserST1()
        {
            ParameterHelper.LaserST1DAL.Save(ParameterHelper.LaserST1);
        }
        public static void SaveLaserST2()
        {
            ParameterHelper.LaserST2DAL.Save(ParameterHelper.LaserST2);
        }
        public static void SaveLaserST3()
        {
            ParameterHelper.LaserST3DAL.Save(ParameterHelper.LaserST3);
        }
        public static void SaveLaserST4()
        {
            ParameterHelper.LaserST4DAL.Save(ParameterHelper.LaserST4);
        }
        public static void SaveLaserST5()
        {
            ParameterHelper.LaserST5DAL.Save(ParameterHelper.LaserST5);
        }
        public static void SaveLaserST6()
        {
            ParameterHelper.LaserST6DAL.Save(ParameterHelper.LaserST6);
        }
        public static void SaveLaserST7()
        {
            ParameterHelper.LaserST7DAL.Save(ParameterHelper.LaserST7);
        }
        public static void SaveLaserST8()
        {
            ParameterHelper.LaserST8DAL.Save(ParameterHelper.LaserST8);
        }
        public static void SaveULDTR1()
        {
            ParameterHelper.ULDTR1DAL.Save(ParameterHelper.ULDTR1);
        }
        public static void SaveULDTR2()
        {
            ParameterHelper.ULDTR2DAL.Save(ParameterHelper.ULDTR2);
        }
        public static void SaveULDST()
        {
            ParameterHelper.ULDSTDAL.Save(ParameterHelper.ULDST);
        }
        public static void SaveULDSTNG()
        {
            ParameterHelper.ULDSTNGDAL.Save(ParameterHelper.ULDSTNG);
        }

        public static void LogMsg(string msg)
        {
            LogHelper.Write(LogHelper.Module.Procedure, msg);
        }
        public static void LogMotionMsg(string Msg)
        {
            LogHelper.Write(LogHelper.Module.Motion_Axis, Msg);
        }

        public static SystemTimeCounter ExchangeTimer = new SystemTimeCounter();
        public static SystemTimeCounter WaitPeelingTimer = new SystemTimeCounter();
        public WaferResult_ToMotion WaferResult_ToMotion = new WaferResult_ToMotion();

        #region 初始化流程
        public static ExcInitStatus ExcInitStatusCode = ExcInitStatus.Init;

        public enum ExcInitStatus
        {
            Init,

            Cylinder_ToDown = 5,

            VacConfirm,
            ToHome_1fst,
            CCD_ZToWait,
            /// <summary>
            /// 
            /// </summary>
            ToHome_2nd=10,
            ToHome_3rd,
           
            /// <summary>
            /// 检测模组Y轴去工作位
            /// </summary>
            InspST_ToWork=20,

            HomeComplete,
        }

        public static InitStatus InitStatusCode = InitStatus.Init;
        public enum InitStatus
        {
            Init,


            PinCylinder_ToDown = 10,
            VacConfirm,
            ST_VacOff,
            Insp1_RM_ZToHome,
            ToHome,




            HomeComplete,
        }

        #endregion

        #region  入料口CV流程
        public static LDCVStatus CV1StatusCode = LDCVStatus.Init;
        public static LDCVStatus CV2StatusCode = LDCVStatus.Init;
        public enum LDCVStatus
        {
            Init,

            CheckStatus = 5,

            Empty = 10,
            LoadPrepare,

            Y_ToLoadPort1 = 20,
            PinCylinder_ToUp_1st,
            LoadReq_1st,
            CV_Run_1st,
            LoadCompleted_1st,

            IDRead_1st,


            Y_ToLoadPort2 = 30,
            PinCylinder_ToUp_2st,
            LoadReq_2st,
            CV_Run_2st,
            LoadCompleted_2st,

            IDRead_2nd,

            CV_Y_ToWork = 40,
            DataCheck,
            CimReport,

            Y_ToInsp1 = 50,
            PinCylinder_ToDown_1st,
            Send_Wait_1st,
            SendOut_Insp1,
            SendCompleted_1st,

            Y_ToInsp2 = 60,
            PinCylinder_ToDown_2st,
            Send_Wait_2st,
            SendOut_Insp2,
            SendCompleted_2st,

            RcvTimeOut=80,

          

            Error=90,

            End=100,
        }

        #endregion

        #region  检测模组

        public static InspStatus Insp1StatusCode = InspStatus.Init;
        public static InspStatus Insp2StatusCode = InspStatus.Init;
        public static InspStatus Insp3StatusCode = InspStatus.Init;
        public static InspStatus Insp4StatusCode = InspStatus.Init;
        public enum InspStatus
        {
            Init,

            CheckStatus = 5,

            Empty = 10,
            LoadPrepare,

            Load = 20,
            PinCylinder_ToUp,
            Receiving,
            RevCompleted, 
            WaitToInsp,

            InspTrigger=30,
            InspST_RM_ZToWork,
            ST_VacOn,
            Scanning,
            InspCompleted,
            ST_VacOff,
            InspST_RM_ZToWait,

            Unload=50,
            PinCylinder_ToDown,            
            SendReady,
            SendOut,
            SendCompeted,

          

            Error=90,
            End=100,
        }

        #endregion

        #region CCD流程
        public static CCDStatus CCD1StatusCode = CCDStatus.Init;
        public static CCDStatus CCD2StatusCode = CCDStatus.Init;
        public enum CCDStatus
        {
            Init,

            CheckStatus = 5,
            Ready,

            ToCH1Reply = 10,
            ToCH1_Mark,
            CH1_LocateTrigger,
            CH1_WaitResult,
            CH1_LocateCal,

            ToCH1_Insp_Idx,
            CH1_InspTrigger,

            CH1_CheckInsp,
            CH1_InspComplete,


            ToCH2Reply = 30,
            ToCH2_Mark,
            CH2_LocateTrigger,
            CH2_WaitResult,
            CH2_LocateCal,
            ToCH2_Insp_Idx,
            CH2_InspTrigger,
            CH2_CheckInsp,
            CH2_InspComplete,
        }
        #endregion



        #region 倒膜平台流程
        public static ExcSTStatus ExcSTStatusCode = ExcSTStatus.Init;

        public enum ExcSTStatus
        {
            Init,

            CheckStatus = 5,

            //Load
            LoadPrepare = 10,
            YR_ToLoad_1st,
            PinCylinder_ToUp_1st,

            LoadReq = 20,
            RBToExcLoad,
            LoadComplete,
            PinCylinder_ToDown,
            ST_VacOn,

            //读码
            XYR_ToScan = 30,
            AtScan,
            Trigger,
            TriggerComplete,


            //UnLoadFrame
            WaitUnLoadFrame = 40,
            YR_ToUnLoad,

            UnLoadFrameReq = 45,
            ST_VacOff_1st,
            WaitingUnLoad,
            UnLoadFrameComplete,

            //预对位
            PreAlignReq = 50,
            PreAlignComplete,


            //倒膜
            YR_ToExchange = 60,
            ExchangeReq,
            ExchangeCylinder_ToDown,
            WaitingExchange,
            ExchangeCylinder_ToUp,
            ExchangeComplete,

            //倒膜结果检查
            ExchangeResultInsp = 70,
            InspComplete,

            //UnLoadEmptyWafer
            YR_ToLoad_2nd = 80,
            ST_VacOff_2nd,
            PinCylinder_ToUp_2nd,

            UnLoadEmptyWaferReq = 85,
            RBToExcUnload,
            PinCylinder_ToDown_2nd,
            UnLoadEmptyWaferComplete,
        }
        #endregion

        #region 倒膜检查
        public static ExcSTInspStatus ExcInspStatusCode = ExcSTInspStatus.Init;       
        public enum ExcSTInspStatus
        {
            Init,

            CheckStatus = 5,
            
            ToAlignPos,

            AtAlignPos,

            Trigger,

            TriggerComplete,
        }

        #endregion

        #region 倒膜及镭射平台平整度检查流程
        public static FlatnesCheckStatus ExcST_FlatnesCheck_StatusCode = FlatnesCheckStatus.Init;
        public static FlatnesCheckStatus LaserST_FlatnesCheck_StatusCode = FlatnesCheckStatus.Init;

        public enum FlatnesCheckStatus
        {
            Init,

            CheckStatus = 5,

            ToCheckPos = 10,
            Cylinder_ToDown,
            ReadValue,
            Cylinder_ToUp,
            ToNext,

            ShowValues = 20,
            CheckComplete,
        }
        #endregion

        #region 倒膜移载流程
        public static ExcTRStatus ExcTRStatusCode = ExcTRStatus.Init;

        public enum ExcTRStatus
        {
            Init,

            CheckStatus = 5,

            //XZ到翻转位
            Z_ToWait_1st =10,
            X_ToFlip,
            


            //铁圈上料
            LoadFrame = 20,
            ClampCylinderOpen_1st,
            R_ToLoad,
            X_ToLoad,
            Z_ToPreLoad,

            LoadFrameReq = 30,
            Z_ToLoad,
            ClampCylinderClose,
            Z_ToWait_2nd,
            LoadFrameComplete,

            //倒膜
            Exchange = 40,
            R_ToExchange,
            X_ToExchange,

            ExchangeReq = 50,
            Z_ToExchange,
            WaitingExchange,//等待饱压延时
            Z_ToFirstPeeling,
            Z_AtFirstPeelingWait,
            Z_ToExchange_2nd,
            Z_ToExchange_Up,
            Z_ToWait_3rd,
            WaitPeelingComplete,
            ExchangeComplete,

            //出料给挑选平台
            UnLoadFrame = 60,
            R_ToUnLoad,

            X_ToUnLoad =70,
            UnloadReq,
            
            Z_ToUnload,
            ClampCylinderOpen_2nd,
            Z_ToFinUnload,
            Z_ToWait_4th,
            UnloadComplete,
        }
        #endregion

        #region 挑拣平台流程
        public static SortSTStatus SortSTStatusCode = SortSTStatus.Init;

        public enum SortSTStatus
        {
            Init,

            XY_ToWait,
            XY_ToUnloadforTRFlip,

            CheckStatus = 5,

            //Load From ExcTR
            LoadFromExcTR = 10,
            PinCylinder_ToDown_1st,
            XY_ToUnload,
            XR_ToLoad,
            Y_ToLoad,

            LoadFromExcTRReq = 20,
            ST_VacOn_1st,
            Y_ToUnload_2nd,
            LoadFromExcTRComplete,

            //Load From Efem
            LoadFromEfem = 30,
            PinCylinder_ToDown_2nd,
            XYR_ToUnload_1st,
            PinCylinder_ToUp_1st,

            LoadFromEfemReq = 40,
            WaitingLoad,
            LoadFromEfemComplete,
            PinCylinder_ToDown_3rd,
            ST_VacOn_2nd,

            //INI文件读取
            IniFileRead,

            //Frame平整度检查
            FrameFlatnesCheckReq = 50,
            FrameFlatnesChekComplete,

            //PreAlignner
            PreAlignReq =60,
            PreAlignComplete,

            //挑选
            Sorter = 70,
            SorterComplete,

            //下料
            UnloadToEfem =80,
            XYR_ToUnload_2nd,
            ST_VacOff,
            PinCylinder_ToUp_2nd,

            UnloadReq = 85,
            RBToSortUnload,
            PinCylinder_ToDown_4th,
            UnloadComplete,
        }
        #endregion

        #region 挑拣NG平台流程
        public static SortNGSTStatus SortNGSTStatusCode = SortNGSTStatus.Init;
        public enum SortNGSTStatus
        {
            Init,

            XY_ToWait,
            XY_ToUnloadforTRFlip,

            CheckStatus = 5,

            //上料
            LoadReq = 10,
            XY_ToWait_LD,
            XR_ToLoad_LD,
            Y_ToLoad_LD,
            NGCylinder_ToUp_LD,

            DoorOpen_LD,

            NGST_VacOn =20,
            WaitReadLotNo,
            PresenceUpdata_LD,

            DoorClose_LD,
            LoadComplete,

            //INI文件读取
            IniFileRead=40,

            //PreAlignner
            PreAlignReq = 60,
            PreAlignComplete,

            //挑选
            Sorter = 70,
            SorterComplete,

            //下料
            UnloadReq = 80,
            XY_ToWait_ULD,
            XR_ToLoad_ULD,
            Y_ToLoad_ULD,
            NGCylinder_ToUp_ULD,

            DoorOpen_ULD,

            NGST_VacOff =90,
            PresenceUpdata_ULD,

            DoorClose_ULD,
            UnLoadComplete,
        }
        #endregion

        #region FrameFlatnesCheck流程
        public static FrameFlatnesCheckStatus SortST_FlatnesCheck_StatusCode = FrameFlatnesCheckStatus.Init;

        public enum FrameFlatnesCheckStatus
        {
            Init,

            CheckStatus,

            XYR_ToFrameFlatnesCheck = 10,

            WaitingFrameFlatnessCheck,

            FrameFlatnesChekComplete,
        }
        #endregion

        #region 挑拣流程
        public static SortStatus SortStatusCode = SortStatus.Init;

        public enum SortStatus
        {
            Init,

            CheckStatus = 5,

            ToDieUnloadBeforeAlign,

            AlignReq =10,
            WaitAlign,
            AlignComplete,
            ToDieUnloadAfterAlign,

            DieUnloadReq = 15,
            DieUnloadReqComplete,

        }
        #endregion

        #region 载入移载流程
        public static LDTRStatus LDTRStatusCode = LDTRStatus.Init;

        public enum LDTRStatus
        {
            Init,
            LDTR_ZToWait,

            CheckStatus = 5,

            ToCCDAligner = 10,//LDTR_R对位位
            WaitAlign,//LDTR_R等待对位

            //Trigger,//对位触发
            //TriggerComplete,//对位完成

            ToLoad = 20,//LDTR_1取料位&LDTR_2出料位
            WaitTR_1_LDAndTR_2_ULD,
            TR_1_LDAndTR_2_ULDComplete,

            ToUnload = 30,//LDTR_2出料位&LDTR_1出料位
            WaitTR_1_ULDAndTR_2_LD,
            TR_1_ULDAndTR_2_LDComplete,
        }
        #endregion

        #region 载出移载流程
        public static ULDTRStatus ULDTRStatusCode = ULDTRStatus.Init;

        public static bool ULDTr1UldProcess = false;
        public static bool ULDTr2UldProcess = false;
        public enum ULDTRStatus
        {
            Init,

            ULDTR_ZToWait_1st,
            CheckStatus = 5,

            ToLoad = 10,//ULDTR_1取料位&LDTR_2出料位
            WaitTR_1_LDAndTR_2_ULD,
            TR_1_LDAndTR_2_ULDComplete,

            ToULDTR1Aligner = 15,//ULDTR1_R对位位
            AtULDTR1WaitAlign,//ULDTR_R对位位延时
            AtULDTR1AlignComplete,
            ULDTR_ZToWait_2nd,

            //Trigger_1st,//对位触发&检测触发
            //TriggerComplete_1st,//对位完成

            ToUnload = 20,//ULDTR_1出料位&LDTR_2取料位
            WaitTR_1_ULDAndTR_2_LD,
            TR_1_ULDAndTR_2_LDComplete,


            ToULDTR2Aligner = 25,//ULDTR2_R对位位
            AtULDTR2WaitAlign,//ULDTR_R对位位延时
            AtULDTR2AlignComplete,
            ULDTR_ZToWait_3rd,

            //Trigger_2nd,//对位触发&检测触发
            //TriggerComplete_2nd,//对位完成


        }
        #endregion

        #region 移载取料流程
        public static TRGetStatus LDTR1GetStatusCode = TRGetStatus.Init;
        public static TRGetStatus LDTR2GetStatusCode = TRGetStatus.Init;
        public static TRGetStatus ULDTR1GetStatusCode = TRGetStatus.Init;
        public static TRGetStatus ULDTR2GetStatusCode = TRGetStatus.Init;

        public enum TRGetStatus
        {
            Init,

            CheckStatus = 5,

            R_ToLoad = 10,//TR_R入料位
            ClampOpen,//夹爪张开

            LoadReq = 15,//出料请求
            Z_ToLoad,//TR_Z入料位
            ClampClose,//夹爪夹
            LaserST_VacOff,

            Z_ToRotaion = 20,//Z 上升0.1mm
            R_ToRotation,//R旋转45度
            Z_ToWait,//TR_Z待命位

            LoadeComplete,//入料完成

        }
        #endregion

        #region 移载放料流程
        public static TRPutStatus LDTR1PutStatusCode = TRPutStatus.Init;
        public static TRPutStatus LDTR2PutStatusCode = TRPutStatus.Init;
        public static TRPutStatus ULDTR1PutStatusCode = TRPutStatus.Init;
        public static TRPutStatus ULDTR2PutStatusCode = TRPutStatus.Init;

        public enum TRPutStatus
        {
            Init,

            CheckStatus = 5,

            R_ToUnload,//TR_R出料位

            UnLoadReq = 10,//出料请求
            Z_ToUnload,//TR_ZOK出料位
            Z_ToNGUnload,//TR_ZNG出料位
            LaserST_VacOn,
            Z_ToUnloadDelay,//TR_ZOK出料位延时打开
            ClampOpen,//夹爪张开

            BlowOn = 20,//吹气开
            Z_ToWait,//TR_Z待命位
            BlowOff,//吹气关
            ClampCloseCheckResult,//夹爪空夹检测

            UnloadComplete,//放料完成

        }
        #endregion

        #region Die去黄膜流程
        public static FilmRemoveStatus ULDTR1FilmRemoveStatusCode = FilmRemoveStatus.Init;
        public static FilmRemoveStatus ULDTR2FilmRemoveStatusCode = FilmRemoveStatus.Init;


        public enum FilmRemoveStatus
        {
            Init,

            ULDST_ToFilmRemove,

            Z_ToFilmRemove,//TR_Z

            Z_ToWait,

        }
        #endregion

        #region 镭射平台流程
        public static LaserSTStatus LaserSTStatusCode = LaserSTStatus.Init;

        public enum LaserSTStatus
        {
            Init,
            ToHome,
            ToLD1,
            checkstatus = 5,

            WaitProcess = 10,
            ProcessComplete,
            RotationToNext,

        }
        #endregion

        #region 镭射流程
        public static LaserStatus LaserStatusCode = LaserStatus.Init;

        public enum LaserStatus
        {
            Init,

            /// <summary>
            /// 设置程序编号
            /// </summary>
            ToSetProgramNo,
            /// <summary>
            /// 设置刻印条件
            /// </summary>
            ToSetMarkingParameter,

            checkstatus = 5,

            /// <summary>
            /// 计算Die的Laser坐标
            /// </summary>
            ToCalcLaserOffset = 10,



            /// <summary>
            /// 设置信息组参数
            /// </summary>
            ToSetBlockNoParams,


            /// <summary>
            /// 设置信息组参数比对
            /// </summary>
            CompareBlock,

            /// <summary>
            /// 开始刻印
            /// </summary>
            ToStartMarking,


            LaserComplete,

        }
        #endregion

        #region 载出平台流程
        public static ULDSTStatus ULDSTStatusCode = ULDSTStatus.Init;
        public static PRM_FixtureInfo AlreadylaserNGInfo { get; set; } = new PRM_FixtureInfo();

        public enum ULDSTStatus
        {
            Init,

            CheckStatus = 5,

            //Load Tray
            LoadTrayReq = 10,
            X_ToTrayLD,
            ExcCylinder_ToDown_1st,
            BallCylinder_ToUp_1st,
            YAndExcY_ToTrayInLD,
            ExcCylinder_ToUp_1st,

            ExcY_ToTrayInULD = 20,
            BallCylinder_ToDown,
            ExcY_ToTrayInWait,
            ST_VacOn,
            ExcCylinder_ToDown_2nd,
            Y_ToWait_1st,
            LoadTrayComplete,

            //PreAlignner
            XY_ToPreAlign1st = 30,
            AtPreAlign1st,
            PreAlign1st_Trigger,
            PreAlign1st_TriggerComplete,

            XY_ToPreAlign2nd = 35,
            AtPreAlign2nd,
            PreAlign2nd_Trigger,
            PreAlign2nd_TriggerComplete,

            //ProductAssembly
            DieLoad = 40,//进入ProductAssembly流程
            DieLoadComplete,

            //UnLoadTray
            UnloadTrayReq = 50,
            X_ToTrayULD,
            ExcCylinder_ToDown_3rd,
            ExcY_ToTrayOutLD,
            Y_ToTrayULD,

            ST_VacOff = 60,
            BallCylinder_ToUp_2nd,
            ExcCylinder_ToUp_2nd,
            ExcY_ToTrayOutULD,
            ExcY_ToTrayOutWait,
            ExcCylinder_ToDown_4th,
            ExcY_ToTrayOutSafe,
            Y_ToWait_2nd,
            UnloadTrayComplete,

        }
        #endregion

        #region 载出平台DieLoad流程
        public static DieLoadStatus DieLoadStatusCode = DieLoadStatus.Init;

        public enum DieLoadStatus
        {
            Init,
            WaitNGTrayChange,

            CheckStatus = 5,

            //ULDST Load OkDie
            LoadOkDie = 10,
            XY_ToOkDieLDBeforAlign,
            OkLDWaitAlign,
            XY_ToOkDieLDAfterAlign,

            LoadOkDieReq = 15,
            LoadOkDieComplete,

            //ULDST Load NGDie
            LoadNGDie = 20,
            XY_ToNGDieLDBeforAlign,
            NGLDWaitAlign,
            NGDieLDPosConfirm,
            XY_ToNGDieLDAfterAlign,

            LoadNoLaserNGDieReq = 25,
            LoadAlreadyLaserNGDieReq,
            LoadNGDieComplete,
        }
        #endregion

        #region 载出平台落Tray吸附流程
        public static DieLoadVacStatus DieLoadVacStatusCode = DieLoadVacStatus.Init;

        public enum DieLoadVacStatus
        {
            Init,

            CheckStatus = 5,

            VacOff=10,

            ExcCylinder_ToDown,

            WaitDataUpdate,

            ExcY_ToDieLD,

            ExcCylinder_ToUp,

            VacOn,
        }
        #endregion

        #region CCD对位及检测流程
        public static AlignStatus SortFinalALGStatusCode = AlignStatus.Init;
        public static AlignStatus LaserALGStatusCode = AlignStatus.Init;
        public static AlignStatus LaserInspStatusCode = AlignStatus.Init;
        public static AlignStatus ULDTR1ALGStatusCode = AlignStatus.Init;
        public static AlignStatus ULDTR2ALGStatusCode = AlignStatus.Init;
        public static AlignStatus DieLoadALGStatusCode = AlignStatus.Init;
        public static AlignStatus ULDTotalTrigerStatusCode = AlignStatus.Init;

        public enum AlignStatus
        {
            Init,

            AtAlignPos,

            Trigger,
            
            WaitResult,

            TriggerComplete,
        }
        #endregion

        #region 流程相关变量
        /// <summary>
        /// 挑拣平台膜厚度量测完成
        /// </summary>
        public static bool SortFrameFlatnessComplete = false;
        /// <summary>
        /// 挑拣平台当前Die编号
        /// </summary>
        public static int CurrentDieIndex = 0;
        /// <summary>
        /// 载出治具当前Tray行编号
        /// </summary>
        public static int TrayRoadCurrentRow = 0;
        public static int TrayRoadCurrentCol = 0;
        /// <summary>
        /// 载出当前Tray行编号
        /// </summary>
        public static int RoadCurrentRow = 0;

        public static int TrayRoadSetStartIdx = 0;

        public static int TrayRoadCurrentIdx = 0;

        public static int RoadCurrentIdx = 0;

        public static int CurrentOkDieCount = 0;

        public static int NoLaserNGTrayRoadCurrentIdx = 0;

        public static int AlreadyLaserNGTrayRoadCurrentIdx = 0;

        public static int NoLaserNGRoadCurrentIdx = 0;

        public static int AlreadyLaserNGRoadCurrentIdx = 0;

        public static int CurrentNoLaserNGDieCount = 0;

        public static int CurrentAlreadyLaserNGDieCount = 0;
        /// <summary>
        /// 载出平台Tray交换
        /// </summary>
        public static bool ULDSTFocusTrayChange = false;
        /// <summary>
        /// 载出平台NG Tray交换
        /// </summary>
        public static bool ULDSTNGTrayFocusChange = false;
        /// <summary>
        /// 载出平台NG Tray交换完成
        /// </summary>
        public static bool ULDSTNGTrayChangeComplete = false;
        /// <summary>
        /// 倒膜进行中
        /// </summary>
        public static bool ExcTR_Exchanging = false;
        /// <summary>
        /// 倒膜移载翻转请求
        /// </summary>
        public static bool ExcTR_FlipReq = false;
        /// <summary>
        /// 挑拣NG平台上料请求
        /// </summary>
        public static bool SortNGST_LDReq = false;
        #endregion

        #region 在席

        public static bool CV1_Presence = false;
        public static bool CV1_Empty = false;

        public static bool CV2_Presence = false;
        public static bool CV2_Empty = false;

        public static bool Insp1_Presence = false;
        public static bool Insp1_Empty = false;

        public static bool Insp2_Presence = false;
        public static bool Insp2_Empty = false;

        public static bool Insp3_Presence = false;
        public static bool Insp3_Empty = false;

        public static bool Insp4_Presence = false;
        public static bool Insp4_Empty = false;

        
        #endregion

        #region 气缸及真空
        public static bool PresenceUpdate = false;
        public static bool ExcST_AllowTransfer = false;
        public static bool SortST_AllowTransfer = false;
             
        public static bool CV1_Cyl_ToUp=false;
        public static bool CV1_Cyl_ToDn = false;
        public static bool CV1_Cyl_ToUp_A = false;
        public static bool CV1_Cyl_ToDn_A = false;
        public static bool CV1_Cyl_Up = false;
        public static bool CV1_Cyl_Dn = false;
        public static bool CV1_Cyl_Up_BL = false;
        public static bool CV1_Cyl_Dn_BL = false;


        public static bool CV2_Cyl_ToUp=false;
        public static bool CV2_Cyl_ToDn = false;
        public static bool CV2_Cyl_ToUp_A = false;
        public static bool CV2_Cyl_ToDn_A = false;
        public static bool CV2_Cyl_Up = false;
        public static bool CV2_Cyl_Dn = false;
        public static bool CV2_Cyl_Up_BL = false;
        public static bool CV2_Cyl_Dn_BL = false;

        public static bool Insp1_Cyl_ToUp = false;
        public static bool Insp1_Cyl_ToDn = false;
        public static bool Insp1_Cyl_ToUp_A = false;
        public static bool Insp1_Cyl_ToDn_A = false;
        public static bool Insp1_Cyl_Up = false;
        public static bool Insp1_Cyl_Dn = false;
        public static bool Insp1_Cyl_Up_BL = false;
        public static bool Insp1_Cyl_Dn_BL = false;

        public static bool Insp1_VacOnn = false;
        public static bool Insp1_VacOff = false;
        public static bool Insp1_ToVacOnn = false;
        public static bool Insp1_ToVacOff = false;
        public static bool Insp1_ToVacOnn_A = false;
        public static bool Insp1_ToVacOff_A = false;
        public static bool Insp1_VacOnn_BL = false;
        public static bool Insp1_VacOff_BL = false;


        public static bool Insp2_Cyl_ToUp = false;
        public static bool Insp2_Cyl_ToDn = false;
        public static bool Insp2_Cyl_ToUp_A = false;
        public static bool Insp2_Cyl_ToDn_A = false;
        public static bool Insp2_Cyl_Up = false;
        public static bool Insp2_Cyl_Dn = false;
        public static bool Insp2_Cyl_Up_BL = false;
        public static bool Insp2_Cyl_Dn_BL = false;

        public static bool Insp2_VacOnn = false;
        public static bool Insp2_VacOff = false;
        public static bool Insp2_ToVacOnn = false;
        public static bool Insp2_ToVacOff = false;
        public static bool Insp2_ToVacOnn_A = false;
        public static bool Insp2_ToVacOff_A = false;
        public static bool Insp2_VacOnn_BL = false;
        public static bool Insp2_VacOff_BL = false;

        public static bool Insp3_Cyl_ToUp = false;
        public static bool Insp3_Cyl_ToDn = false;
        public static bool Insp3_Cyl_ToUp_A = false;
        public static bool Insp3_Cyl_ToDn_A = false;
        public static bool Insp3_Cyl_Up = false;
        public static bool Insp3_Cyl_Dn = false;
        public static bool Insp3_Cyl_Up_BL = false;
        public static bool Insp3_Cyl_Dn_BL = false;

        public static bool Insp3_VacOnn = false;
        public static bool Insp3_VacOff = false;
        public static bool Insp3_ToVacOnn = false;
        public static bool Insp3_ToVacOff = false;
        public static bool Insp3_ToVacOnn_A = false;
        public static bool Insp3_ToVacOff_A = false;
        public static bool Insp3_VacOnn_BL = false;
        public static bool Insp3_VacOff_BL = false;

        public static bool Insp4_Cyl_ToUp = false;
        public static bool Insp4_Cyl_ToDn = false;
        public static bool Insp4_Cyl_ToUp_A = false;
        public static bool Insp4_Cyl_ToDn_A = false;
        public static bool Insp4_Cyl_Up = false;
        public static bool Insp4_Cyl_Dn = false;
        public static bool Insp4_Cyl_Up_BL = false;
        public static bool Insp4_Cyl_Dn_BL = false;

        public static bool Insp4_VacOnn = false;
        public static bool Insp4_VacOff = false;
        public static bool Insp4_ToVacOnn = false;
        public static bool Insp4_ToVacOff = false;
        public static bool Insp4_ToVacOnn_A = false;
        public static bool Insp4_ToVacOff_A = false;
        public static bool Insp4_VacOnn_BL = false;
        public static bool Insp4_VacOff_BL = false;

        public static bool SafeDoor1_Lockk = false;
        public static bool SafeDoor1_ULock = false;
        public static bool SafeDoor1_ToLockk = false;
        public static bool SafeDoor1_ToULock = false;
        public static bool SafeDoor1_ToLockk_A = false;
        public static bool SafeDoor1_ToULock_A = false;
        public static bool SafeDoor1_ToLockk_BL = false;
        public static bool SafeDoor1_ToULock_BL = false;

        public static bool SafeDoor2_Lockk = false;
        public static bool SafeDoor2_ULock = false;
        public static bool SafeDoor2_ToLockk = false;
        public static bool SafeDoor2_ToULock = false;
        public static bool SafeDoor2_ToLockk_A = false;
        public static bool SafeDoor2_ToULock_A = false;
        public static bool SafeDoor2_ToLockk_BL = false;
        public static bool SafeDoor2_ToULock_BL = false;

       public static bool Insp1_Hard_Existence =false;
       public static bool Insp2_Hard_Existence =false;
       public static bool Insp3_Hard_Existence =false;
       public static bool Insp4_Hard_Existence = false;

        public static bool Insp1_Hard_Nothing = false;
        public static bool Insp2_Hard_Nothing = false;
        public static bool Insp3_Hard_Nothing = false;
        public static bool Insp4_Hard_Nothing = false;


        #region  OLD
        public static bool ExcST_ToVacOn = false;
        public static bool ExcST_ToVacOff = false;

        public static bool ExcST_ToVacOn_A = false;
        public static bool ExcST_ToVacOff_A = false;

        public static bool ExcST_ToUp = false;
        public static bool ExcST_ToDown = false;

        public static bool ExcST_ToUp_A = false;
        public static bool ExcST_ToDown_A = false;

        public static bool Exc_ToUp = false;
        public static bool Exc_ToDown = false;

        public static bool Exc_ToUp_A = false;
        public static bool Exc_ToDown_A = false;

        public static bool Exc_MS_ToUp = false;
        public static bool Exc_MS_ToDown = false;

        public static bool Exc_MS_ToUp_A = false;
        public static bool Exc_MS_ToDown_A = false;

        public static bool ExcTR_ToClose = false;
        public static bool ExcTR_ToOpen = false;

        public static bool ExcTR_ToClose_A = false;
        public static bool ExcTR_ToOpen_A = false;

        public static bool SortST_ToVacOn = false;
        public static bool SortST_ToVacOff = false;

        public static bool SortST_ToVacOn_A = false;
        public static bool SortST_ToVacOff_A = false;

        public static bool SortST_NG_ToVacOn = false;
        public static bool SortST_NG_ToVacOff = false;

        public static bool SortST_NG_ToVacOn_A = false;
        public static bool SortST_NG_ToVacOff_A = false;

        public static bool LDTR1_ToBlowOn = false;
        public static bool LDTR1_ToBlowOff = false;

        public static bool LDTR1_ToBlowOn_A = false;
        public static bool LDTR1_ToBlowOff_A = false;

        public static bool LDTR2_ToBlowOn = false;
        public static bool LDTR2_ToBlowOff = false;

        public static bool LDTR2_ToBlowOn_A = false;
        public static bool LDTR2_ToBlowOff_A = false;

        public static bool ULDTR1_ToBlowOn = false;
        public static bool ULDTR1_ToBlowOff = false;

        public static bool ULDTR1_ToBlowOn_A = false;
        public static bool ULDTR1_ToBlowOff_A = false;

        public static bool ULDTR2_ToBlowOn = false;
        public static bool ULDTR2_ToBlowOff = false;

        public static bool ULDTR2_ToBlowOn_A = false;
        public static bool ULDTR2_ToBlowOff_A = false;

        public static bool SortST_ToUp = false;
        public static bool SortST_ToDown = false;

        public static bool SortST_ToUp_A = false;
        public static bool SortST_ToDown_A = false;

        public static bool SortST_NG_ToUp = false;
        public static bool SortST_NG_ToDown= false;

        public static bool SortST_NG_ToUp_A = false;
        public static bool SortST_NG_ToDown_A = false;

        public static bool LaserST1_ToVacOn = false;
        public static bool LaserST1_ToVacOff = false;

        public static bool LaserST1_ToVacOn_A = false;
        public static bool LaserST1_ToVacOff_A = false;

        public static bool LaserST2_ToVacOn = false;
        public static bool LaserST2_ToVacOff = false;

        public static bool LaserST2_ToVacOn_A = false;
        public static bool LaserST2_ToVacOff_A = false;

        public static bool LaserST3_ToVacOn = false;
        public static bool LaserST3_ToVacOff = false;

        public static bool LaserST3_ToVacOn_A = false;
        public static bool LaserST3_ToVacOff_A = false;

        public static bool LaserST4_ToVacOn = false;
        public static bool LaserST4_ToVacOff = false;

        public static bool LaserST4_ToVacOn_A = false;
        public static bool LaserST4_ToVacOff_A = false;

        public static bool LaserST5_ToVacOn = false;
        public static bool LaserST5_ToVacOff = false;

        public static bool LaserST5_ToVacOn_A = false;
        public static bool LaserST5_ToVacOff_A = false;

        public static bool LaserST6_ToVacOn = false;
        public static bool LaserST6_ToVacOff = false;

        public static bool LaserST6_ToVacOn_A = false;
        public static bool LaserST6_ToVacOff_A = false;

        public static bool LaserST7_ToVacOn = false;
        public static bool LaserST7_ToVacOff = false;

        public static bool LaserST7_ToVacOn_A = false;
        public static bool LaserST7_ToVacOff_A = false;

        public static bool LaserST8_ToVacOn = false;
        public static bool LaserST8_ToVacOff = false;

        public static bool LaserST8_ToVacOn_A = false;
        public static bool LaserST8_ToVacOff_A = false;

        public static bool ULDST_ToVacOn = false;
        public static bool ULDST_ToVacOff = false;

        public static bool ULDST_ToVacOn_A = false;
        public static bool ULDST_ToVacOff_A = false;

        public static bool ULDST_ToDieVacOn = false;
        public static bool ULDST_ToDieVacOff = false;

        public static bool ULDST_ToDieVacOn_A = false;
        public static bool ULDST_ToDieVacOff_A = false;

        public static bool ULDST_Ext_ToUp = false;
        public static bool ULDST_Ext_ToDown = false;

        public static bool ULDST_Ext_ToUp_A = false;
        public static bool ULDST_Ext_ToDown_A = false;

        public static bool ULDST_Ball_ToUp = false;
        public static bool ULDST_Ball_ToDown = false;

        public static bool ULDST_Ball_ToUp_A = false;
        public static bool ULDST_Ball_ToDown_A = false;

        //public static bool Door_ToLock = false;
        //public static bool Door_ToUnlock = false;

        public static bool Laser_MS_ToUp = false;
        public static bool Laser_MS_ToDown = false;

        public static bool Laser_MS_ToUp_A = false;
        public static bool Laser_MS_ToDown_A = false;

        //public static bool Light_Open = false;

        public static bool ExcST_Vac = false;
        public static bool ExcST_Down = false;
        public static bool ExcST_Up = false;

        public static bool ExcST_Vac_BL = false;
        public static bool ExcST_Down_BL = false;
        public static bool ExcST_Up_BL = false;

        public static bool Exc_Down = false;
        public static bool Exc_Up = false;
        public static bool Exc_MS_Down = false;
        public static bool Exc_MS_Up = false;

        public static bool Exc_Down_BL = false;
        public static bool Exc_Up_BL = false;
        public static bool Exc_MS_Down_BL = false;
        public static bool Exc_MS_Up_BL = false;

        public static bool ExcTR_Close = false;
        public static bool ExcTR_Open = false;

        public static bool ExcTR_Close_BL = false;
        public static bool ExcTR_Open_BL = false;

        public static bool SortST_Vac = false;
        public static bool SortST_NG_Vac = false;
        public static bool SortST_Up = false;
        public static bool SortST_Down = false;
        public static bool SortST_NG_Up = false;
        public static bool SortST_NG_Down = false;

        public static bool SortST_Vac_BL = false;
        public static bool SortST_NG_Vac_BL = false;
        public static bool SortST_Up_BL = false;
        public static bool SortST_Down_BL = false;
        public static bool SortST_NG_Up_BL = false;
        public static bool SortST_NG_Down_BL = false;

        public static bool LaserST1_Vac = false;
        public static bool LaserST2_Vac = false;
        public static bool LaserST3_Vac= false;
        public static bool LaserST4_Vac = false;
        public static bool LaserST5_Vac = false;
        public static bool LaserST6_Vac = false;
        public static bool LaserST7_Vac = false;
        public static bool LaserST8_Vac = false;

        public static bool LaserST1_Vac_BL = false;
        public static bool LaserST2_Vac_BL = false;
        public static bool LaserST3_Vac_BL = false;
        public static bool LaserST4_Vac_BL = false;
        public static bool LaserST5_Vac_BL = false;
        public static bool LaserST6_Vac_BL = false;
        public static bool LaserST7_Vac_BL = false;
        public static bool LaserST8_Vac_BL = false;

        public static bool ULDST_Vac = false;
        public static bool ULDST_DieVac = false;
        public static bool ULDST_Ext_Up = false;
        public static bool ULDST_Ext_Down = false;
        public static bool ULDST_Ball1_Up = false;
        public static bool ULDST_Ball1_Down = false;
        public static bool ULDST_Ball2_Up = false;
        public static bool ULDST_Ball2_Down = false;

        public static bool ULDST_Vac_BL = false;
        public static bool ULDST_DieVac_BL = false;
        public static bool ULDST_Ext_Up_BL = false;
        public static bool ULDST_Ext_Down_BL = false;
        public static bool ULDST_Ball1_Up_BL = false;
        public static bool ULDST_Ball1_Down_BL = false;
        public static bool ULDST_Ball2_Up_BL = false;
        public static bool ULDST_Ball2_Down_BL = false;

        public static bool LDTR1_BlowOn_BL = false;
        public static bool LDTR1_BlowOff_BL = false;
        public static bool LDTR2_BlowOn_BL = false;
        public static bool LDTR2_BlowOff_BL = false;

        public static bool ULDTR1_BlowOn_BL = false;
        public static bool ULDTR1_BlowOff_BL = false;
        public static bool ULDTR2_BlowOn_BL = false;
        public static bool ULDTR2_BlowOff_BL = false;

        public static bool Laser_MS_Up = false;
        public static bool Laser_MS_Down = false;

        public static bool Laser_MS_Up_BL = false;
        public static bool Laser_MS_Down_BL = false;
        #endregion
#endregion

        #region 镭射激光刻印相关
        public static bool SetProgramComplete = false;
        public static bool SetMarkingParameterComplete = false;
        public static bool Laser_ToPowerCheck_A = false;
        public static string LaserSpotInspWaferID = "";
        public static uint LaserSpotInspCount = 0;
        public static string laserIniPath = "";
        #endregion

        #region 相机光源

        public static bool CCD1_RingLightOn = false;
        public static bool CCD1_RingLightOn_A = false;

        public static bool CCD1_CoaLightOn = false;
        public static bool CCD1_CoaLightOn_A = false;

        public static bool CCD2_RingLightOn = false;
        public static bool CCD2_RingLightOn_A = false;
                              
        public static bool CCD2_CoaLightOn = false;
        public static bool CCD2_CoaLightOn_A = false;

        public static bool ExcST_CodeReadLightOn = false;
        public static bool ExcST_CodeReadLightOn_A = false;

        public static bool ExcST_BallLightOn = false;
        public static bool ExcST_BallLightOn_A = false;

        public static bool ExcST_CoaxialLightOn = false;
        public static bool ExcST_CoaxialLightOn_A = false;

        public static bool SortST_PreAlignLightOn = false;
        public static bool SortST_PreAlignLightOn_A = false;

        public static bool SortST_FinalAlignLightOn = false;
        public static bool SortST_FinalAlignLightOn_A = false;

        public static bool LaserST_UpperCoaxialLightOn = false;
        public static bool LaserST_UpperCoaxialLightOn_A = false;

        public static bool LaserST_UpperBallLightOn = false;
        public static bool LaserST_UpperBallLightOn_A = false;

        public static bool LaserST_SideCoaxialLightOn = false;
        public static bool LaserST_SideCoaxialLightOn_A = false;

        public static bool LaserST_SideBackLightOn = false;
        public static bool LaserST_SideBackLightOn_A = false;

        public static bool LaserST_InspCoaxialLightOn = false;
        public static bool LaserST_InspCoaxialLightOn_A = false;

        public static bool LaserST_InspBallLightOn = false;
        public static bool LaserST_InspBallLightOn_A = false;

        public static bool ULDTR1_AlignLightOn = false;
        public static bool ULDTR1_AlignLightOn_A = false;

        public static bool ULDTR2_AlignLightOn = false;
        public static bool ULDTR2_AlignLightOn_A = false;

        public static bool ULDST_PreAlignLightOn = false;
        public static bool ULDST_PreAlignLightOn_A = false;

        public static bool ULDST_FinalAlignLightOn = false;
        public static bool ULDST_FinalAlignLightOn_A = false;

        public static bool Efem_RingLightOn = false;
        public static bool Efem_RingLightOn_A = false;

        public static bool Efem_CoaxialLightOn = false;
        public static bool Efem_CoaxialLightOn_A = false;

        #endregion

        #region 相机

        public static bool Insp1_FinalInsped = false;
        public static bool Insp1_FinalAlignOK = false;
        public static bool Insp1_FinalAlignNGPass = false;

        public static bool Insp2_FinalInsped = false;
        public static bool Insp2_FinalAlignOK = false;
        public static bool Insp2_FinalAlignNGPass = false;

        public static bool Insp3_FinalInsped = false;
        public static bool Insp3_FinalAlignOK = false;
        public static bool Insp3_FinalAlignNGPass = false;

        public static bool Insp4_FinalInsped = false;
        public static bool Insp4_FinalAlignOK = false;
        public static bool Insp4_FinalAlignNGPass = false;

        public static bool EfemAlignOK = false;
        public static double EfemAlignOffset_X = 0;
        public static double EfemAlignOffset_Y = 0;
        public static double EfemAlignOffset_R = 0;

        public static bool ExcSTReadCodeOK = false;
        /// <summary>
        /// 读码NG启用扫码枪
        /// </summary>
        public static bool ExcSTCodeScanEnable = false;
        public static string ExcSTCode = "";

        public static bool ExcSTInsped = false;
        /// <summary>
        /// 1 OK 2 NG
        /// </summary>
        public static int ExcSTInspRet = 0;
        /// <summary>
        /// 倒膜平台当前Die数量
        /// </summary>
        public static uint ExcSTMappingDieCount = 0;

        public static bool SortSTFirstAlignOK = false;
        public static bool SortNGSTFirstAlignOK = false;

        public static bool SortSTFinalInsped = false;
        public static bool SortSTFinalAlignOK = false;
        public static bool SortSTFinalAlignNGPass = false;
        public static double SortSTFinalAlignOffset_X = 0;
        public static double SortSTFinalAlignOffset_Y = 0;
        public static double SortSTFinalAlignOffset_R = 0;

        public static double SortSTFinalAlignForTR1_X = 0;
        public static double SortSTFinalAlignForTR1_Y = 0;
        public static double SortSTFinalAlignForTR1_R = 0;
        public static double SortSTFinalAlignForTR1_StageR = 0;

        public static double SortSTFinalAlignForTR2_X = 0;
        public static double SortSTFinalAlignForTR2_Y = 0;
        public static double SortSTFinalAlignForTR2_R = 0;
        public static double SortSTFinalAlignForTR2_StageR = 0;

        public static bool DieUpInsped = false;
        public static bool DieFrontInsped = false;
        public static bool DieUpAlignOK = false;
        public static bool DieFrontAlignOk = false;
        /// <summary>
        /// 1 OK 2 NG
        /// </summary>
        public static int DieUp_InspRet = 0;
        /// <summary>
        /// 1 OK 2 NG
        /// </summary>
        public static int DieFront_InspRet = 0;
        public static double DieOffset_X = 0;
        public static double DieOffset_Y = 0;
        public static double DieOffset_Z = 0;

        public static bool LaserCodeReadOK = false;
        public static string LaserReadCode = "";

        public static bool ULDTR_1_Insped = false;
        public static bool ULDTR_1_AlignOk = false;
        /// <summary>
        /// 1 OK 2 NG
        /// </summary>
        public static int ULDTR_1_InspRet = 0;
        public static double ULDTR_1_Offset_X = 0;
        public static double ULDTR_1_Offset_Y = 0;
        public static double ULDTR_1_Offset_R = 0;

        public static bool ULDTR_2_Insped = false;
        public static bool ULDTR_2_AlignOk = false;
        /// <summary>
        /// 1 OK 2 NG
        /// </summary>
        public static int ULDTR_2_InspRet = 0;
        public static double ULDTR_2_Offset_X = 0;
        public static double ULDTR_2_Offset_Y = 0;
        public static double ULDTR_2_Offset_R = 0;

        public static int ULDST_AcqIdx = 0;

        public static bool ULDSTFirstAlignOK = false;
        public static double ULDSTFirstOffset_X = 0;
        public static double ULDSTFirstOffset_Y = 0;

        public static bool ULDTotalTrigered = false;
        public static bool ULDSTFinalInsped = false;
        public static bool ULDSTFinalAlignOK = false;
        public static double ULDSTFinalOffset_X = 0;
        public static double ULDSTFinalOffset_Y = 0;
        public static double ULDSTFinalOffset_R = 0;

        public static double ULDSTOffset_X = 0;
        public static double ULDSTOffset_Y = 0;
        #endregion

        #region  入口CV1轨道切换
        public static bool CV1_TrackSW_Y_AllowMove = false;
        public static bool CV1_TrackSW_Y_ToStop = false;
        public static bool CV1_TrackSW_Y_ToHome = false;
        public static bool CV1_TrackSW_Y_ToRecv = false;
        public static bool CV1_TrackSW_Y_ToLDPt1 = false;
        public static bool CV1_TrackSW_Y_ToLDPt2 = false;
        public static bool CV1_TrackSW_Y_ToInsp1 = false;
        public static bool CV1_TrackSW_Y_ToInsp2 = false;

        public static bool CV1_TrackSW_Y_ToHome_A = false;
        public static bool CV1_TrackSW_Y_ToRecv_A = false;
        public static bool CV1_TrackSW_Y_LDPt1_A = false;
        public static bool CV1_TrackSW_Y_LDPt2_A = false;
        public static bool CV1_TrackSW_Y_ToInsp1_A = false;
        public static bool CV1_TrackSW_Y_ToInsp2_A = false;

        public static bool CV1_TrackSW_Y_Homed = false;
        public static bool CV1_TrackSW_Y_LDPt1 = false;
        public static bool CV1_TrackSW_Y_LDPt2 = false;
        public static bool CV1_TrackSW_Y_Recv = false;
        public static bool CV1_TrackSW_Y_Insp1 = false;
        public static bool CV1_TrackSW_Y_Insp2 = false;

        public static bool CV1_TrackSW_Y_Homed_BL = false;
        public static bool CV1_TrackSW_Y_Recv_BL = false;
        public static bool CV1_TrackSW_Y_LDPt1_BL = false;
        public static bool CV1_TrackSW_Y_LDPt2_BL = false;
        public static bool CV1_TrackSW_Y_Insp1_BL = false;
        public static bool CV1_TrackSW_Y_Insp2_BL = false;
        #endregion

        #region 入口CV1定位Y轴
        public static bool CV1_Y_AllowMove = false;
        public static bool CV1_Y_ToStop = false;
        public static bool CV1_Y_ToHome = false;
        public static bool CV1_Y_ToWork = false;
        public static bool CV1_Y_ToWait = false;

        public static bool CV1_Y_ToHome_A = false;
        public static bool CV1_Y_ToWork_A = false;
        public static bool CV1_Y_ToWait_A = false;

        public static bool CV1_Y_Homed = false;
        public static bool CV1_Y_Work = false;
        public static bool CV1_Y_Wait = false;

        public static bool CV1_Y_Homed_BL = false;
        public static bool CV1_Y_Work_BL = false;
        public static bool CV1_Y_Wait_BL = false;
        #endregion

        #region 入口CV2轨道切换
        public static bool CV2_TrackSW_Y_AllowMove = false;
        public static bool CV2_TrackSW_Y_ToStop = false;
        public static bool CV2_TrackSW_Y_ToHome = false;
        public static bool CV2_TrackSW_Y_ToRecv = false;
        public static bool CV2_TrackSW_Y_ToLDPt1 = false;
        public static bool CV2_TrackSW_Y_ToLDPt2 = false;
        public static bool CV2_TrackSW_Y_ToInsp1 = false;
        public static bool CV2_TrackSW_Y_ToInsp2 = false;
                             
        public static bool CV2_TrackSW_Y_ToHome_A = false;
        public static bool CV2_TrackSW_Y_ToRecv_A = false;
        public static bool CV2_TrackSW_Y_LDPt1_A = false;
        public static bool CV2_TrackSW_Y_LDPt2_A = false;
        public static bool CV2_TrackSW_Y_ToInsp1_A = false;
        public static bool CV2_TrackSW_Y_ToInsp2_A = false;
                             
        public static bool CV2_TrackSW_Y_Homed = false;
        public static bool CV2_TrackSW_Y_LDPt1 = false;
        public static bool CV2_TrackSW_Y_LDPt2 = false;
        public static bool CV2_TrackSW_Y_Recv = false;
        public static bool CV2_TrackSW_Y_Insp1 = false;
        public static bool CV2_TrackSW_Y_Insp2 = false;
                             
        public static bool CV2_TrackSW_Y_Homed_BL = false;
        public static bool CV2_TrackSW_Y_Recv_BL = false;
        public static bool CV2_TrackSW_Y_LDPt1_BL = false;
        public static bool CV2_TrackSW_Y_LDPt2_BL = false;
        public static bool CV2_TrackSW_Y_Insp1_BL = false;
        public static bool CV2_TrackSW_Y_Insp2_BL = false;





        #endregion

        #region  入口CV2定位Y轴
        public static bool CV2_Y_AllowMove = false;
        public static bool CV2_Y_ToStop = false;
        public static bool CV2_Y_ToHome = false;
        public static bool CV2_Y_ToWork = false;
        public static bool CV2_Y_ToWait = false;
                            
        public static bool CV2_Y_ToHome_A = false;
        public static bool CV2_Y_ToWork_A = false;
        public static bool CV2_Y_ToWait_A = false;
                            
        public static bool CV2_Y_Homed = false;
        public static bool CV2_Y_Work = false;
        public static bool CV2_Y_Wait = false;
                             
        public static bool CV2_Y_Homed_BL = false;
        public static bool CV2_Y_Work_BL = false;
        public static bool CV2_Y_Wait_BL = false;

        #endregion

        #region CCD1_X
        public static bool CCD1_X_AllowMove = false;
        public static bool CCD1_X_ToStop = false;
        public static bool CCD1_X_ToHome = false;
        public static bool CCD1_X_ToCH1Mark = false;
        public static bool CCD1_X_ToCH1Work = false;
        public static bool CCD1_X_ToCH2Mark = false;
        public static bool CCD1_X_ToCH2Work = false; 
        public static bool CCD1_X_ToWait = false;
                           
        public static bool CCD1_X_ToHome_A = false;
        public static bool CCD1_X_ToCH1Mark_A = false;
        public static bool CCD1_X_ToCH1Work_A = false;
        public static bool CCD1_X_ToCH2Mark_A = false;
        public static bool CCD1_X_ToCH2Work_A = false;
        public static bool CCD1_X_ToWait_A = false;

        public static bool CCD1_X_Homed   = false;
        public static bool CCD1_X_CH1Mark = false;
        public static bool CCD1_X_CH1Work = false;
        public static bool CCD1_X_CH2Mark = false;
        public static bool CCD1_X_CH2Work = false;
        public static bool CCD1_X_Wait    = false;

        public static bool CCD1_X_Homed_BL = false; 
        public static bool CCD1_X_CH1Mark_BL = false;
        public static bool CCD1_X_CH1Work_BL = false;
        public static bool CCD1_X_CH2Mark_BL = false;
        public static bool CCD1_X_CH2Work_BL = false;
        public static bool CCD1_X_Wait_BL = false;
        #endregion

        #region CCD1_Y
        public static bool CCD1_Y_AllowMove = false;
        public static bool CCD1_Y_ToStop = false;
        public static bool CCD1_Y_ToHome = false;
        public static bool CCD1_Y_ToCH1Mark = false;
        public static bool CCD1_Y_ToCH1Work = false;
        public static bool CCD1_Y_ToCH2Mark = false;
        public static bool CCD1_Y_ToCH2Work = false;
        public static bool CCD1_Y_ToWait = false;
                            
        public static bool CCD1_Y_ToHome_A = false;
        public static bool CCD1_Y_ToCH1Mark_A = false;
        public static bool CCD1_Y_ToCH1Work_A = false;
        public static bool CCD1_Y_ToCH2Mark_A = false;
        public static bool CCD1_Y_ToCH2Work_A = false;
        public static bool CCD1_Y_ToWait_A = false;
                              
        public static bool CCD1_Y_Homed = false;
        public static bool CCD1_Y_CH1Mark = false;
        public static bool CCD1_Y_CH1Work = false;
        public static bool CCD1_Y_CH2Mark = false;
        public static bool CCD1_Y_CH2Work = false;
        public static bool CCD1_Y_Wait = false;
                              
        public static bool CCD1_Y_Homed_BL = false;
        public static bool CCD1_Y_CH1Mark_BL = false;
        public static bool CCD1_Y_CH1Work_BL = false;
        public static bool CCD1_Y_CH2Mark_BL = false;
        public static bool CCD1_Y_CH2Work_BL = false;
        public static bool CCD1_Y_Wait_BL = false;
        #endregion

        #region CCD1_Z
        public static bool CCD1_Z_AllowMove = false;
        public static bool CCD1_Z_ToStop = false;
        public static bool CCD1_Z_ToHome = false;
        public static bool CCD1_Z_ToCH1Mark = false;
        public static bool CCD1_Z_ToCH1Work = false;
        public static bool CCD1_Z_ToCH2Mark = false;
        public static bool CCD1_Z_ToCH2Work = false;
        public static bool CCD1_Z_ToWait = false;
                                
        public static bool CCD1_Z_ToHome_A = false;
        public static bool CCD1_Z_ToCH1Mark_A = false;
        public static bool CCD1_Z_ToCH1Work_A = false;
        public static bool CCD1_Z_ToCH2Mark_A = false;
        public static bool CCD1_Z_ToCH2Work_A = false;
        public static bool CCD1_Z_ToWait_A = false;
                               
        public static bool CCD1_Z_Homed = false;
        public static bool CCD1_Z_CH1Mark = false;
        public static bool CCD1_Z_CH1Work = false;
        public static bool CCD1_Z_CH2Mark = false;
        public static bool CCD1_Z_CH2Work = false;
        public static bool CCD1_Z_Wait = false;
                                
        public static bool CCD1_Z_Homed_BL = false;
        public static bool CCD1_Z_CH1Mark_BL = false;
        public static bool CCD1_Z_CH1Work_BL = false;
        public static bool CCD1_Z_CH2Mark_BL = false;
        public static bool CCD1_Z_CH2Work_BL = false;
        public static bool CCD1_Z_Wait_BL = false;
        #endregion

        #region CCD2_X
        public static bool CCD2_X_AllowMove = false;
        public static bool CCD2_X_ToStop = false;
        public static bool CCD2_X_ToHome = false;
        public static bool CCD2_X_ToCH1Mark = false;
        public static bool CCD2_X_ToCH1Work = false;
        public static bool CCD2_X_ToCH2Mark = false;
        public static bool CCD2_X_ToCH2Work = false;
        public static bool CCD2_X_ToWait = false;

        public static bool CCD2_X_ToHome_A = false;
        public static bool CCD2_X_ToCH1Mark_A = false;
        public static bool CCD2_X_ToCH1Work_A = false;
        public static bool CCD2_X_ToCH2Mark_A = false;
        public static bool CCD2_X_ToCH2Work_A = false;
        public static bool CCD2_X_ToWait_A = false;

        public static bool CCD2_X_Homed = false;
        public static bool CCD2_X_CH1Mark = false;
        public static bool CCD2_X_CH1Work = false;
        public static bool CCD2_X_CH2Mark = false;
        public static bool CCD2_X_CH2Work = false;
        public static bool CCD2_X_Wait = false;

        public static bool CCD2_X_Homed_BL = false;
        public static bool CCD2_X_CH1Mark_BL = false;
        public static bool CCD2_X_CH1Work_BL = false;
        public static bool CCD2_X_CH2Mark_BL = false;
        public static bool CCD2_X_CH2Work_BL = false;
        public static bool CCD2_X_Wait_BL = false;
        #endregion

        #region CCD2_Y
        public static bool CCD2_Y_AllowMove = false;
        public static bool CCD2_Y_ToStop = false;
        public static bool CCD2_Y_ToHome = false;
        public static bool CCD2_Y_ToCH1Mark = false;
        public static bool CCD2_Y_ToCH1Work = false;
        public static bool CCD2_Y_ToCH2Mark = false;
        public static bool CCD2_Y_ToCH2Work = false;
        public static bool CCD2_Y_ToWait = false;
                              
        public static bool CCD2_Y_ToHome_A = false;
        public static bool CCD2_Y_ToCH1Mark_A = false;
        public static bool CCD2_Y_ToCH1Work_A = false;
        public static bool CCD2_Y_ToCH2Mark_A = false;
        public static bool CCD2_Y_ToCH2Work_A = false;
        public static bool CCD2_Y_ToWait_A = false;
                              
        public static bool CCD2_Y_Homed = false;
        public static bool CCD2_Y_CH1Mark = false;
        public static bool CCD2_Y_CH1Work = false;
        public static bool CCD2_Y_CH2Mark = false;
        public static bool CCD2_Y_CH2Work = false;
        public static bool CCD2_Y_Wait = false;
                              
        public static bool CCD2_Y_Homed_BL = false;
        public static bool CCD2_Y_CH1Mark_BL = false;
        public static bool CCD2_Y_CH1Work_BL = false;
        public static bool CCD2_Y_CH2Mark_BL = false;
        public static bool CCD2_Y_CH2Work_BL = false;
        public static bool CCD2_Y_Wait_BL = false;
        #endregion            

        #region CCD2_Z
        public static bool CCD2_Z_AllowMove = false;
        public static bool CCD2_Z_ToStop = false;
        public static bool CCD2_Z_ToHome = false;
        public static bool CCD2_Z_ToCH1Mark = false;
        public static bool CCD2_Z_ToCH1Work = false;
        public static bool CCD2_Z_ToCH2Mark = false;
        public static bool CCD2_Z_ToCH2Work = false;
        public static bool CCD2_Z_ToWait = false;
                              
        public static bool CCD2_Z_ToHome_A = false;
        public static bool CCD2_Z_ToCH1Mark_A = false;
        public static bool CCD2_Z_ToCH1Work_A = false;
        public static bool CCD2_Z_ToCH2Mark_A = false;
        public static bool CCD2_Z_ToCH2Work_A = false;
        public static bool CCD2_Z_ToWait_A = false;
                              
        public static bool CCD2_Z_Homed = false;
        public static bool CCD2_Z_CH1Mark = false;
        public static bool CCD2_Z_CH1Work = false;
        public static bool CCD2_Z_CH2Mark = false;
        public static bool CCD2_Z_CH2Work = false;
        public static bool CCD2_Z_Wait = false;
                              
        public static bool CCD2_Z_Homed_BL = false;
        public static bool CCD2_Z_CH1Mark_BL = false;
        public static bool CCD2_Z_CH1Work_BL = false;
        public static bool CCD2_Z_CH2Mark_BL = false;
        public static bool CCD2_Z_CH2Work_BL = false;
        public static bool CCD2_Z_Wait_BL = false;
        #endregion

        #region 检测模组1
        public static bool Insp1_Y_AllowMove = false;
        public static bool Insp1_Y_ToStop = false;
        public static bool Insp1_Y_ToHome = false;
        public static bool Insp1_Y_ToWork = false;
        public static bool Insp1_Y_ToWait = false;
                           
        public static bool Insp1_Y_ToHome_A = false;
        public static bool Insp1_Y_ToWork_A = false;
        public static bool Insp1_Y_ToWait_A = false;
                           
        public static bool Insp1_Y_Homed = false;
        public static bool Insp1_Y_Work = false;
        public static bool Insp1_Y_Wait = false;
                           
        public static bool Insp1_Y_Homed_BL = false;
        public static bool Insp1_Y_Work_BL = false;
        public static bool Insp1_Y_Wait_BL = false;

        #endregion

        #region 检测模组2
        public static bool Insp2_Y_AllowMove = false;
        public static bool Insp2_Y_ToStop = false;
        public static bool Insp2_Y_ToHome = false;
        public static bool Insp2_Y_ToWork = false;
        public static bool Insp2_Y_ToWait = false;
                            
        public static bool Insp2_Y_ToHome_A = false;
        public static bool Insp2_Y_ToWork_A = false;
        public static bool Insp2_Y_ToWait_A = false;
                             
        public static bool Insp2_Y_Homed = false;
        public static bool Insp2_Y_Work = false;
        public static bool Insp2_Y_Wait = false;
                              
        public static bool Insp2_Y_Homed_BL = false;
        public static bool Insp2_Y_Work_BL = false;
        public static bool Insp2_Y_Wait_BL = false;

        #endregion

        #region 检测模组3
        public static bool Insp3_Y_AllowMove = false;
        public static bool Insp3_Y_ToStop = false;
        public static bool Insp3_Y_ToHome = false;
        public static bool Insp3_Y_ToWork = false;
        public static bool Insp3_Y_ToWait = false;
                            
        public static bool Insp3_Y_ToHome_A = false;
        public static bool Insp3_Y_ToWork_A = false;
        public static bool Insp3_Y_ToWait_A = false;
                               
        public static bool Insp3_Y_Homed = false;
        public static bool Insp3_Y_Work = false;
        public static bool Insp3_Y_Wait = false;
                               
        public static bool Insp3_Y_Homed_BL = false;
        public static bool Insp3_Y_Work_BL = false;
        public static bool Insp3_Y_Wait_BL = false;

        #endregion

        #region 检测模组4
        public static bool Insp4_Y_AllowMove = false;
        public static bool Insp4_Y_ToStop = false;
        public static bool Insp4_Y_ToHome = false;
        public static bool Insp4_Y_ToWork = false;
        public static bool Insp4_Y_ToWait = false;
                               
        public static bool Insp4_Y_ToHome_A = false;
        public static bool Insp4_Y_ToWork_A = false;
        public static bool Insp4_Y_ToWait_A = false;
                               
        public static bool Insp4_Y_Homed = false;
        public static bool Insp4_Y_Work = false;
        public static bool Insp4_Y_Wait = false;
                               
        public static bool Insp4_Y_Homed_BL = false;
        public static bool Insp4_Y_Work_BL = false;
        public static bool Insp4_Y_Wait_BL = false;
        #endregion

        #region 检测模组1力控
        public static bool Insp1_RM_Z_AllowMove = false;
        public static bool Insp1_RM_Z_ToStop = false;
        public static bool Insp1_RM_Z_ToHome = false;
        public static bool Insp1_RM_Z_ToWork = false;
        public static bool Insp1_RM_Z_ToWait = false;                               
        public static bool Insp1_RM_Z_ToHome_A = false;
        public static bool Insp1_RM_Z_ToWork_A = false;
        public static bool Insp1_RM_Z_ToWait_A = false;                               
        public static bool Insp1_RM_Z_Homed = false;
        public static bool Insp1_RM_Z_Work = false;
        public static bool Insp1_RM_Z_Wait = false;                               
        public static bool Insp1_RM_Z_Homed_BL = false;
        public static bool Insp1_RM_Z_Work_BL = false;
        public static bool Insp1_RM_Z_Wait_BL = false;

        public static bool Insp1_RM_Z_RstForce = false;
        #endregion

        #region 检测模组2力控
        public static bool Insp2_RM_Z_AllowMove = false;
        public static bool Insp2_RM_Z_ToStop = false;
        public static bool Insp2_RM_Z_ToHome = false;
        public static bool Insp2_RM_Z_ToWork = false;
        public static bool Insp2_RM_Z_ToWait = false;
        public static bool Insp2_RM_Z_ToHome_A = false;
        public static bool Insp2_RM_Z_ToWork_A = false;
        public static bool Insp2_RM_Z_ToWait_A = false;
        public static bool Insp2_RM_Z_Homed = false;
        public static bool Insp2_RM_Z_Work = false;
        public static bool Insp2_RM_Z_Wait = false;
        public static bool Insp2_RM_Z_Homed_BL = false;
        public static bool Insp2_RM_Z_Work_BL = false;
        public static bool Insp2_RM_Z_Wait_BL = false;

        public static bool Insp2_RM_Z_RstForce = false;
        #endregion

        #region 检测模组3力控
        public static bool Insp3_RM_Z_AllowMove = false;
        public static bool Insp3_RM_Z_ToStop = false;
        public static bool Insp3_RM_Z_ToHome = false;
        public static bool Insp3_RM_Z_ToWork = false;
        public static bool Insp3_RM_Z_ToWait = false;
        public static bool Insp3_RM_Z_ToHome_A = false;
        public static bool Insp3_RM_Z_ToWork_A = false;
        public static bool Insp3_RM_Z_ToWait_A = false;
        public static bool Insp3_RM_Z_Homed = false;
        public static bool Insp3_RM_Z_Work = false;
        public static bool Insp3_RM_Z_Wait = false;
        public static bool Insp3_RM_Z_Homed_BL = false;
        public static bool Insp3_RM_Z_Work_BL = false;
        public static bool Insp3_RM_Z_Wait_BL = false;

        public static bool Insp3_RM_Z_RstForce = false;
        #endregion

        #region 检测模组4力控
        public static bool Insp4_RM_Z_AllowMove = false;
        public static bool Insp4_RM_Z_ToStop = false;
        public static bool Insp4_RM_Z_ToHome = false;
        public static bool Insp4_RM_Z_ToWork = false;
        public static bool Insp4_RM_Z_ToWait = false;
        public static bool Insp4_RM_Z_ToHome_A = false;
        public static bool Insp4_RM_Z_ToWork_A = false;
        public static bool Insp4_RM_Z_ToWait_A = false;
        public static bool Insp4_RM_Z_Homed = false;
        public static bool Insp4_RM_Z_Work = false;
        public static bool Insp4_RM_Z_Wait = false;
        public static bool Insp4_RM_Z_Homed_BL = false;
        public static bool Insp4_RM_Z_Work_BL = false;
        public static bool Insp4_RM_Z_Wait_BL = false;

        public static bool Insp4_RM_Z_RstForce = false;
        #endregion

        #region  CV控制
        public static bool CV1_AllowRun = false;
        public static bool CV1_ToRun = false;
        public static bool CV1_ToStop = false;
        public static bool CV1_ToRun_A = false;
        public static bool CV1_ToStop_A = false;
        public static bool CV1_Run = false;
        public static bool CV1_Stop = false;
        public static bool CV1_Run_BL = false;
        public static bool CV1_Stop_BL = false;

        public static bool CV2_AllowRun = false;
        public static bool CV2_ToRun = false;
        public static bool CV2_ToStop = false;
        public static bool CV2_ToRun_A = false;
        public static bool CV2_ToStop_A = false;
        public static bool CV2_Run = false;
        public static bool CV2_Stop = false;
        public static bool CV2_Run_BL = false;
        public static bool CV2_Stop_BL = false;

        public static bool Insp1CV_AllowRun = false;
        public static bool Insp1CV_ToRun = false;
        public static bool Insp1CV_ToStop = false;
        public static bool Insp1CV_ToRun_A = false;
        public static bool Insp1CV_ToStop_A = false;
        public static bool Insp1CV_Run = false;
        public static bool Insp1CV2_Run = false;
        public static bool Insp1CV_Stop = false;
        public static bool Insp1CV_Run_BL = false;
        public static bool Insp1CV_Stop_BL = false;

        public static bool Insp2CV_AllowRun = false;
        public static bool Insp2CV_ToRun = false;
        public static bool Insp2CV_ToStop = false;
        public static bool Insp2CV_ToRun_A = false;
        public static bool Insp2CV_ToStop_A = false;
        public static bool Insp2CV_Run = false;
        public static bool Insp2CV2_Run = false;
        public static bool Insp2CV_Stop = false;
        public static bool Insp2CV_Run_BL = false;
        public static bool Insp2CV_Stop_BL = false;

        public static bool Insp3CV_AllowRun = false;
        public static bool Insp3CV_ToRun = false;
        public static bool Insp3CV_ToStop = false;
        public static bool Insp3CV_ToRun_A = false;
        public static bool Insp3CV_ToStop_A = false;
        public static bool Insp3CV_Run = false;
        public static bool Insp3CV2_Run = false;
        public static bool Insp3CV_Stop = false;
        public static bool Insp3CV_Run_BL = false;
        public static bool Insp3CV_Stop_BL = false;

        public static bool Insp4CV_AllowRun = false;
        public static bool Insp4CV_ToRun = false;
        public static bool Insp4CV_ToStop = false;
        public static bool Insp4CV_ToRun_A = false;
        public static bool Insp4CV_ToStop_A = false;
        public static bool Insp4CV_Run = false;
        public static bool Insp4CV2_Run = false;
        public static bool Insp4CV_Stop = false;
        public static bool Insp4CV_Run_BL = false;
        public static bool Insp4CV_Stop_BL = false;
        #endregion


        #region 上下游交互
        public static bool ToUp_CH1_Ready = false;
        public static bool ToUp_CH1_Receiving = false;
        public static bool ToUp_CH1_Ready_A = false;
        public static bool ToUp_CH1_Receiving_A = false;
        public static bool ToUp_CH1_Ready_M = false;
        public static bool ToUp_CH1_Receiving_M = false;
        public static bool ToUp_CH1_Ready_Cancel_M = false;
        public static bool ToUp_CH1_Ready_Cancel_A = false;
        public static bool ToUp_CH1_Receiving_Cancel_M = false;
        public static bool ToUp_CH1_Receiving_Cancel_A = false;


        public static bool ToUp_CH2_Ready = false;
        public static bool ToUp_CH2_Receiving = false;
        public static bool ToUp_CH2_Ready_A = false;
        public static bool ToUp_CH2_Receiving_A = false;
        public static bool ToUp_CH2_Ready_M = false;
        public static bool ToUp_CH2_Receiving_M = false;
        public static bool ToUp_CH2_Ready_Cancel_M = false;
        public static bool ToUp_CH2_Ready_Cancel_A = false;
        public static bool ToUp_CH2_Receiving_Cancel_M = false;
        public static bool ToUp_CH2_Receiving_Cancel_A = false;

        public static bool ToUp_CH3_Ready = false;
        public static bool ToUp_CH3_Receiving = false;
        public static bool ToUp_CH3_Ready_A = false;
        public static bool ToUp_CH3_Receiving_A = false;
        public static bool ToUp_CH3_Ready_M = false;
        public static bool ToUp_CH3_Receiving_M = false;
        public static bool ToUp_CH3_Ready_Cancel_M = false;
        public static bool ToUp_CH3_Ready_Cancel_A = false;
        public static bool ToUp_CH3_Receiving_Cancel_M = false;
        public static bool ToUp_CH3_Receiving_Cancel_A = false;

        public static bool ToUp_CH4_Ready = false;
        public static bool ToUp_CH4_Receiving = false;
        public static bool ToUp_CH4_Ready_A = false;
        public static bool ToUp_CH4_Receiving_A = false;
        public static bool ToUp_CH4_Ready_M = false;
        public static bool ToUp_CH4_Receiving_M = false;
        public static bool ToUp_CH4_Ready_Cancel_M = false;
        public static bool ToUp_CH4_Ready_Cancel_A = false;
        public static bool ToUp_CH4_Receiving_Cancel_M = false;
        public static bool ToUp_CH4_Receiving_Cancel_A = false;

        public static bool ToDn_CH1_Ready = false;
        public static bool ToDn_CH1_Sending = false;
        public static bool ToDn_CH1_Ready_A = false;
        public static bool ToDn_CH1_Sending_A = false;
        public static bool ToDn_CH1_Ready_M = false;
        public static bool ToDn_CH1_Sending_M = false;
        public static bool ToDn_CH1_Ready_Cancel_M = false;
        public static bool ToDn_CH1_Ready_Cancel_A = false;
        public static bool ToDn_CH1_Sending_Cancel_M = false;
        public static bool ToDn_CH1_Sending_Cancel_A = false;

        public static bool ToDn_CH2_Ready = false;
        public static bool ToDn_CH2_Sending = false;
        public static bool ToDn_CH2_Ready_A = false;
        public static bool ToDn_CH2_Sending_A = false;
        public static bool ToDn_CH2_Ready_M = false;
        public static bool ToDn_CH2_Sending_M = false;
        public static bool ToDn_CH2_Ready_Cancel_M = false;
        public static bool ToDn_CH2_Ready_Cancel_A = false;
        public static bool ToDn_CH2_Sending_Cancel_M = false;
        public static bool ToDn_CH2_Sending_Cancel_A = false;

        public static bool ToDn_CH3_Ready = false;
        public static bool ToDn_CH3_Sending = false;
        public static bool ToDn_CH3_Ready_A = false;
        public static bool ToDn_CH3_Sending_A = false;
        public static bool ToDn_CH3_Ready_M = false;
        public static bool ToDn_CH3_Sending_M = false;
        public static bool ToDn_CH3_Ready_Cancel_M = false;
        public static bool ToDn_CH3_Ready_Cancel_A = false;
        public static bool ToDn_CH3_Sending_Cancel_M = false;
        public static bool ToDn_CH3_Sending_Cancel_A = false;

        public static bool ToDn_CH4_Ready = false;
        public static bool ToDn_CH4_Sending = false;
        public static bool ToDn_CH4_Ready_A = false;
        public static bool ToDn_CH4_Sending_A = false;
        public static bool ToDn_CH4_Ready_M = false;
        public static bool ToDn_CH4_Sending_M = false;
        public static bool ToDn_CH4_Ready_Cancel_M = false;
        public static bool ToDn_CH4_Ready_Cancel_A = false;
        public static bool ToDn_CH4_Sending_Cancel_M = false;
        public static bool ToDn_CH4_Sending_Cancel_A = false;
        #endregion


        #region 读码触发
        public static bool CodeRead1 = false;
        public static bool CodeRead1_M = false;
        public static bool CodeRead1_A = false;
        public static bool CodeRead1_Completed = false;
        public static bool CodeRead1_Pass = false;

        public static bool CodeRead2 = false;
        public static bool CodeRead2_M = false;
        public static bool CodeRead2_A = false;
        public static bool CodeRead2_Completed = false;
        public static bool CodeRead2_Pass =false;

        #endregion


        #region ExcST
        public static bool ExcST_AllowMove = false;
        public static bool ExcST_ToStop = false;
        public static bool ExcST_ToHome = false;
        public static bool ExcST_ToLD = false;
        public static bool ExcST_ToExchange = false;
        public static bool ExcST_ToCodeRead = false;
        public static bool ExcST_ToExcInsp = false;

        public static bool ExcST_ToHome_A = false;
        public static bool ExcST_ToLD_A = false;
        public static bool ExcST_ToExchange_A = false;
        public static bool ExcST_ToCodeRead_A = false;
        public static bool ExcST_ToExcInsp_A = false;

        public static bool ExcST_Homed = false;
        public static bool ExcST_LD = false;
        public static bool ExcST_Exchange = false;
        public static bool ExcST_CodeRead = false;
        public static bool ExcST_ExcInsp = false;

        public static bool ExcST_Homed_BL = false;
        public static bool ExcST_LD_BL = false;
        public static bool ExcST_Exchange_BL = false;
        public static bool ExcST_CodeRead_BL = false;
        public static bool ExcST_ExcInsp_BL = false;

        public static bool ExcST_Y_LD = false;
        public static bool ExcST_R_LD = false;

        public static bool ExcST_Y_Exchange = false;
        public static bool ExcST_Y_CodeRead = false;
        public static bool ExcST_Y_ExcInsp = false;
        #endregion

        #region ExcCCD
        public static bool ExcCCD_ToStop = false;
        public static bool ExcCCD_ToHome = false;
        public static bool ExcCCD_ToCodeRead = false;
        public static bool ExcCCD_ToExcInsp = false;


        public static bool ExcCCD_ToHome_A = false;
        public static bool ExcCCD_ToCodeRead_A = false;
        public static bool ExcCCD_ToExcInsp_A = false;

        public static bool ExcCCD_Homed = false;
        public static bool ExcCCD_CodeRead = false;
        public static bool ExcCCD_ExcInsp = false;

        public static bool ExcCCD_Homed_BL = false;
        public static bool ExcCCD_CodeRead_BL = false;
        public static bool ExcCCD_ExcInsp_BL = false;

        #endregion

        #region ExcTR_X
        public static bool ExcTR_X_AllowMove = false;
        public static bool ExcTR_X_ToStop = false;
        public static bool ExcTR_X_ToHome = false;
        public static bool ExcTR_X_ToExchange = false;
        public static bool ExcTR_X_ToULD = false;
        public static bool ExcTR_X_ToFlip = false;

        public static bool ExcTR_X_ToHome_A = false;
        public static bool ExcTR_X_ToExchagne_A = false;
        public static bool ExcTR_X_ToULD_A = false;
        public static bool ExcTR_X_ToFlip_A = false;

        public static bool ExcTR_X_Homed = false;
        public static bool ExcTR_X_Exchange = false;
        public static bool ExcTR_X_ULD = false;
        public static bool ExcTR_X_Flip = false;

        public static bool ExcTR_X_Homed_BL = false;
        public static bool ExcTR_X_Exchange_BL = false;
        public static bool ExcTR_X_ULD_BL = false;
        public static bool ExcTR_X_Flip_BL = false;

        public static bool ExcTR_X_AtFlip = false;
        #endregion

        #region EcxTR_Z
        public static bool ExcTR_Z_AllowHome = false;
        public static bool ExcTR_Z_ToStop = false;
        public static bool ExcTR_Z_ToHome = false;
        public static bool ExcTR_Z_ToPreLD = false;
        public static bool ExcTR_Z_ToLD = false;
        public static bool ExcTR_Z_ToExchange = false;
        public static bool ExcTR_Z_ToULD = false;
        public static bool ExcTR_Z_ToFinULD = false;        
        public static bool ExcTR_Z_ToWait = false;
        public static bool ExcTR_Z_ToFirstPeeling = false;
        public static bool ExcTR_Z_ToExchangeUp = false;

        public static bool ExcTR_Z_ToHome_A = false;
        public static bool ExcTR_Z_ToPreLD_A = false;
        public static bool ExcTR_Z_ToLD_A = false;
        public static bool ExcTR_Z_ToExchange_A = false;
        public static bool ExcTR_Z_ToULD_A = false;
        public static bool ExcTR_Z_ToFinULD_A = false;
        public static bool ExcTR_Z_ToWait_A = false;
        public static bool ExcTR_Z_ToFirstPeeling_A = false;
        public static bool ExcTR_Z_ToExchangeUp_A = false;

        public static bool ExcTR_Z_Homed = false;
        public static bool ExcTR_Z_PreLD = false;
        public static bool ExcTR_Z_LD = false;
        public static bool ExcTR_Z_Exchange = false;
        public static bool ExcTR_Z_ULD = false;
        public static bool ExcTR_Z_FinULD = false;
        public static bool ExcTR_Z_Wait = false;
        public static bool ExcTR_Z_FirstPeeling = false;
        public static bool ExcTR_Z_ExchangeUp = false;

        public static bool ExcTR_Z_Homed_BL = false;
        public static bool ExcTR_Z_PreLD_BL = false;
        public static bool ExcTR_Z_LD_BL = false;
        public static bool ExcTR_Z_Exchange_BL = false;
        public static bool ExcTR_Z_ULD_BL = false;
        public static bool ExcTR_Z_FinULD_BL = false;
        public static bool ExcTR_Z_Wait_BL = false;
        public static bool ExcTR_Z_FirstPeeling_BL = false;
        public static bool ExcTR_Z_ExchangeUp_BL = false;

        public static bool ExcTR_Z_AtWait = false;
        #endregion

        #region ExcTR_R
        public static bool ExcTR_R_AllowMove = false;
        public static bool ExcTR_R_ToStop = false;
        public static bool ExcTR_R_ToHome = false;
        public static bool ExcTR_R_ToLD = false;
        public static bool ExcTR_R_ToExchange = false;

        public static bool ExcTR_R_ToHome_A = false;
        public static bool ExcTR_R_ToLD_A = false;
        public static bool ExcTR_R_ToExchange_A = false;

        public static bool ExcTR_R_Homed = false;
        public static bool ExcTR_R_LD = false;
        public static bool ExcTR_R_Exchange = false;

        public static bool ExcTR_R_Homed_BL = false;
        public static bool ExcTR_R_LD_BL = false;
        public static bool ExcTR_R_Exchange_BL = false;

        public static bool ExcTR_R_AtLD = false;
        public static bool ExcTR_R_AtExc = false;
        #endregion

        #region SortST_X
        public static bool SortST_X_AllowHome = false;
        public static bool SortST_X_AllowMove = false;
        public static bool SortST_X_ToStop = false;
        public static bool SortST_X_ToHome = false;
        public static bool SortST_X_ToWait = false;
        public static bool SortST_X_ToLD = false;
        public static bool SortST_X_ToULD = false;
        public static bool SortST_X_ToALG1 = false;
        public static bool SortST_X_ToALG2 = false;
        public static bool SortST_X_ToSort = false;

        public static bool SortST_X_ToHome_A = false;
        public static bool SortST_X_ToWait_A = false;
        public static bool SortST_X_ToLD_A = false;
        public static bool SortST_X_ToULD_A = false;
        public static bool SortST_X_ToALG1_A = false;
        public static bool SortST_X_ToALG2_A = false;
        public static bool SortST_X_ToSort_A = false;

        public static bool SortST_X_Homed = false;
        public static bool SortST_X_Wait = false;
        public static bool SortST_X_LD = false;
        public static bool SortST_X_ULD = false;
        public static bool SortST_X_ALG1 = false;
        public static bool SortST_X_ALG2 = false;
        public static bool SortST_X_Sort = false;

        public static bool SortST_X_Homed_BL = false;
        public static bool SortST_X_Wait_BL = false;
        public static bool SortST_X_LD_BL = false;
        public static bool SortST_X_ULD_BL = false;
        public static bool SortST_X_ALG1_BL = false;
        public static bool SortST_X_ALG2_BL = false;
        public static bool SortST_X_Sort_BL = false;

        public static bool SortST_X_AtULD = false;
        public static double SortPos_Sort_X = 0;

        #endregion

        #region SortST_Y
        public static bool SortST_Y_AllowHome = false;
        public static bool SortST_Y_AllowMove = false;
        public static bool SortST_Y_ToStop = false;
        public static bool SortST_Y_ToWait = false;
        public static bool SortST_Y_ToHome = false;
        public static bool SortST_Y_ToLD = false;
        public static bool SortST_Y_ToULD = false;
        public static bool SortST_Y_ToALG1 = false;
        public static bool SortST_Y_ToALG2 = false;
        public static bool SortST_Y_ToSort = false;

        public static bool SortST_Y_ToHome_A = false;
        public static bool SortST_Y_ToWait_A = false;
        public static bool SortST_Y_ToLD_A = false;
        public static bool SortST_Y_ToULD_A = false;
        public static bool SortST_Y_ToALG1_A = false;
        public static bool SortST_Y_ToALG2_A = false;
        public static bool SortST_Y_ToSort_A = false;

        public static bool SortST_Y_Homed = false;
        public static bool SortST_Y_Wait = false;
        public static bool SortST_Y_LD = false;
        public static bool SortST_Y_ULD = false;
        public static bool SortST_Y_ALG1 = false;
        public static bool SortST_Y_ALG2 = false;
        public static bool SortST_Y_Sort = false;

        public static bool SortST_Y_Homed_BL = false;
        public static bool SortST_Y_Wait_BL = false;
        public static bool SortST_Y_LD_BL = false;
        public static bool SortST_Y_ULD_BL = false;
        public static bool SortST_Y_ALG1_BL = false;
        public static bool SortST_Y_ALG2_BL = false;
        public static bool SortST_Y_Sort_BL = false;

        public static bool SortST_Y_AtULD = false;
        public static double SortPos_Sort_Y = 0;
        #endregion

        #region SortST_R
        public static bool SortST_R_AllowMove = false;
        public static bool SortST_R_ToStop = false;
        public static bool SortST_R_ToHome = false;
        public static bool SortST_R_ToTransfer = false;
        public static bool SortST_R_ToSort = false;

        public static bool SortST_R_ToHome_A = false;
        public static bool SortST_R_ToTransfer_A = false;
        public static bool SortST_R_ToSort_A = false;

        public static bool SortST_R_Homed = false;
        public static bool SortST_R_Transfer = false;
        public static bool SortST_R_Sort = false;

        public static bool SortST_R_Homed_BL = false;
        public static bool SortST_R_Transfer_BL = false;
        public static bool SortST_R_Sort_BL = false;

        public static double SortPos_Sort_R = 0;
        #endregion

        #region LDTR_1_Z
        public static bool LDTR_1_Z_ToStop = false;
        public static bool LDTR_1_Z_ToHome = false;
        public static bool LDTR_1_Z_ToGet = false;
        public static bool LDTR_1_Z_ToPut = false;
        public static bool LDTR_1_Z_ToWait = false;
        public static bool LDTR_1_Z_ToRotation = false;

        public static bool LDTR_1_Z_ToHome_A = false;
        public static bool LDTR_1_Z_ToGet_A = false;
        public static bool LDTR_1_Z_ToPut_A = false;
        public static bool LDTR_1_Z_ToWait_A = false;
        public static bool LDTR_1_Z_ToRotation_A = false;

        public static bool LDTR_1_Z_Homed = false;
        public static bool LDTR_1_Z_Get = false;
        public static bool LDTR_1_Z_Put = false;
        public static bool LDTR_1_Z_Wait = false;
        public static bool LDTR_1_Z_Rotation = false;

        public static bool LDTR_1_Z_Homed_BL = false;
        public static bool LDTR_1_Z_Get_BL = false;
        public static bool LDTR_1_Z_Put_BL = false;
        public static bool LDTR_1_Z_Wait_BL = false;
        public static bool LDTR_1_Z_Rotation_BL = false;

        public static bool LDTR_1_ZAtWait = false;
        #endregion

        #region LDTR_1_R
        public static bool LDTR_1_R_AllowMove = false;
        public static bool LDTR_1_R_ToStop = false;
        public static bool LDTR_1_R_ToHome = false;
        public static bool LDTR_1_R_ToULD = false;
        public static bool LDTR_1_R_ToLD_0 = false;
        public static bool LDTR_1_R_ToLD_90R = false;
        public static bool LDTR_1_R_ToLD_180R = false;
        public static bool LDTR_1_R_ToLD_90F = false;
        public static bool LDTR_1_R_ToRotation = false;

        public static bool LDTR_1_R_ToHome_A = false;
        public static bool LDTR_1_R_ToULD_A = false;
        public static bool LDTR_1_R_ToLD_0_A = false;
        public static bool LDTR_1_R_ToLD_90R_A = false;
        public static bool LDTR_1_R_ToLD_180R_A = false;
        public static bool LDTR_1_R_ToLD_90F_A = false;
        public static bool LDTR_1_R_ToRotation_A = false;

        public static bool LDTR_1_R_Homed = false;
        public static bool LDTR_1_R_ULD = false;
        public static bool LDTR_1_R_LD_0 = false;
        public static bool LDTR_1_R_LD_90R = false;
        public static bool LDTR_1_R_LD_180R = false;
        public static bool LDTR_1_R_LD_90F = false;
        public static bool LDTR_1_R_Rotation = false;

        public static bool LDTR_1_R_Homed_BL = false;
        public static bool LDTR_1_R_ULD_BL = false;
        public static bool LDTR_1_R_LD_0_BL = false;
        public static bool LDTR_1_R_LD_90R_BL = false;
        public static bool LDTR_1_R_LD_180R_BL = false;
        public static bool LDTR_1_R_LD_90F_BL = false;
        public static bool LDTR_1_R_Rotation_BL = false;

        public static double SortPos_LDTR_1_R = 0;
        public static double RotationPos_LDTR_1_R = 0;
        #endregion

        #region LDTR_1_Clamp
        public static bool LDTR_1_Clamp_ToClose = false;
        public static bool LDTR_1_Clamp_ToOpen = false;
        public static bool LDTR_1_Clamp_ToHome = false;
        public static bool LDTR_1_Clamp_ToStop = false;
        public static bool LDTR_1_Clamp_ToSVON = false;

        public static bool LDTR_1_Clamp_ToClose_A = false;
        public static bool LDTR_1_Clamp_ToOpen_A = false;
        public static bool LDTR_1_Clamp_ToHome_A = false;

        public static bool LDTR_1_Clamp_Close = false;
        public static bool LDTR_1_Clamp_Open = false;
        public static bool LDTR_1_Clamp_Homed = false;
        public static bool LDTR_1_Clamp_SVON = false;

        public static bool LDTR_1_Clamp_Close_BL = false;
        public static bool LDTR_1_Clamp_Open_BL = false;
        public static bool LDTR_1_Clamp_Homed_BL = false;
        public static bool LDTR_1_Clamp_SVON_BL = false;
        public static int LDTR_1_Clamp_TarPos = 0;
        #endregion

        #region LDTR_2_Z
        public static bool LDTR_2_Z_ToStop = false;
        public static bool LDTR_2_Z_ToHome = false;
        public static bool LDTR_2_Z_ToGet = false;
        public static bool LDTR_2_Z_ToPut = false;
        public static bool LDTR_2_Z_ToWait = false;
        public static bool LDTR_2_Z_ToRotation = false;

        public static bool LDTR_2_Z_ToHome_A = false;
        public static bool LDTR_2_Z_ToGet_A = false;
        public static bool LDTR_2_Z_ToPut_A = false;
        public static bool LDTR_2_Z_ToWait_A = false;
        public static bool LDTR_2_Z_ToRotation_A = false;

        public static bool LDTR_2_Z_Homed = false;
        public static bool LDTR_2_Z_Get = false;
        public static bool LDTR_2_Z_Put = false;
        public static bool LDTR_2_Z_Wait = false;
        public static bool LDTR_2_Z_Rotation = false;

        public static bool LDTR_2_Z_Homed_BL = false;
        public static bool LDTR_2_Z_Get_BL = false;
        public static bool LDTR_2_Z_Put_BL = false;
        public static bool LDTR_2_Z_Wait_BL = false;
        public static bool LDTR_2_Z_Rotation_BL = false;

        public static bool LDTR_2_ZAtWait = false;
        #endregion

        #region LDTR_2_R
        public static bool LDTR_2_R_AllowMove = false;
        public static bool LDTR_2_R_ToStop = false;
        public static bool LDTR_2_R_ToHome = false;
        public static bool LDTR_2_R_ToULD = false;
        public static bool LDTR_2_R_ToLD_0 = false;
        public static bool LDTR_2_R_ToLD_90R = false;
        public static bool LDTR_2_R_ToLD_180R = false;
        public static bool LDTR_2_R_ToLD_90F = false;
        public static bool LDTR_2_R_ToRotation = false;

        public static bool LDTR_2_R_ToHome_A = false;
        public static bool LDTR_2_R_ToULD_A = false;
        public static bool LDTR_2_R_ToLD_0_A = false;
        public static bool LDTR_2_R_ToLD_90R_A = false;
        public static bool LDTR_2_R_ToLD_180R_A = false;
        public static bool LDTR_2_R_ToLD_90F_A = false;
        public static bool LDTR_2_R_ToRotation_A = false;

        public static bool LDTR_2_R_Homed = false;
        public static bool LDTR_2_R_ULD = false;
        public static bool LDTR_2_R_LD_0 = false;
        public static bool LDTR_2_R_LD_90R = false;
        public static bool LDTR_2_R_LD_180R = false;
        public static bool LDTR_2_R_LD_90F = false;
        public static bool LDTR_2_R_Rotation = false;

        public static bool LDTR_2_R_Homed_BL = false;
        public static bool LDTR_2_R_ULD_BL = false;
        public static bool LDTR_2_R_LD_0_BL = false;
        public static bool LDTR_2_R_LD_90R_BL = false;
        public static bool LDTR_2_R_LD_180R_BL = false;
        public static bool LDTR_2_R_LD_90F_BL = false;
        public static bool LDTR_2_R_Rotation_BL = false;

        public static double SortPos_LDTR_2_R = 0;
        public static double RotationPos_LDTR_2_R = 0;
        #endregion

        #region LDTR_2_Clamp
        public static bool LDTR_2_Clamp_ToClose = false;
        public static bool LDTR_2_Clamp_ToOpen = false;
        public static bool LDTR_2_Clamp_ToHome = false;
        public static bool LDTR_2_Clamp_ToStop = false;
        public static bool LDTR_2_Clamp_ToSVON = false;

        public static bool LDTR_2_Clamp_ToClose_A = false;
        public static bool LDTR_2_Clamp_ToOpen_A = false;
        public static bool LDTR_2_Clamp_ToHome_A = false;

        public static bool LDTR_2_Clamp_Close = false;
        public static bool LDTR_2_Clamp_Open = false;
        public static bool LDTR_2_Clamp_Homed = false;
        public static bool LDTR_2_Clamp_SVON = false;

        public static bool LDTR_2_Clamp_Close_BL = false;
        public static bool LDTR_2_Clamp_Open_BL = false;
        public static bool LDTR_2_Clamp_Homed_BL = false;
        public static bool LDTR_2_Clamp_SVON_BL = false;
        public static int LDTR_2_Clamp_TarPos = 0;
        #endregion

        #region LDTR_R
        public static bool LDTR_R_AllowMove = false;
        public static bool LDTR_R_ToStop = false;
        public static bool LDTR_R_ToHome = false;
        public static bool LDTR_R_ToLD = false;
        public static bool LDTR_R_ToULD = false;
        public static bool LDTR_R_ToALG = false;

        public static bool LDTR_R_ToHome_A = false;
        public static bool LDTR_R_ToLD_A = false;
        public static bool LDTR_R_ToULD_A = false;
        public static bool LDTR_R_ToALG_A = false;

        public static bool LDTR_R_Homed = false;
        public static bool LDTR_R_LD = false;
        public static bool LDTR_R_ULD = false;
        public static bool LDTR_R_ALG = false;

        public static bool LDTR_R_Homed_BL = false;
        public static bool LDTR_R_LD_BL = false;
        public static bool LDTR_R_ULD_BL = false;
        public static bool LDTR_R_ALG_BL = false;
        #endregion

        #region LDTR_CCD
        public static bool LDTR_CCD_ToStop = false;
        public static bool LDTR_CCD_ToHome = false;
        public static bool LDTR_CCD_ToALG = false;

        public static bool LDTR_CCD_ToHome_A = false;
        public static bool LDTR_CCD_ToALG_A = false;

        public static bool LDTR_CCD_Homed = false;
        public static bool LDTR_CCD_ALG = false;

        public static bool LDTR_CCD_Homed_BL = false;
        public static bool LDTR_CCD_ALG_BL = false;
        #endregion

        #region LaserST_R
        public static bool LaserST_R_AllowMove = false;
        public static bool LaserST_R_ToStop = false;
        public static bool LaserST_R_ToHome = false;
        public static bool LaserST_R_ToLD1 = false;
        public static bool LaserST_R_ToLD2 = false;
        public static bool LaserST_R_ToLD3 = false;
        public static bool LaserST_R_ToLD4 = false;
        public static bool LaserST_R_ToLD5 = false;
        public static bool LaserST_R_ToLD6 = false;
        public static bool LaserST_R_ToLD7 = false;
        public static bool LaserST_R_ToLD8 = false;
        public static bool LaserST_R_ToNext = false;
        public static bool LaserST_R_ToPrevious = false;

        public static bool LaserST_R_ToHome_A = false;
        public static bool LaserST_R_ToLD1_A = false;
        public static bool LaserST_R_ToLD2_A = false;
        public static bool LaserST_R_ToLD3_A = false;
        public static bool LaserST_R_ToLD4_A = false;
        public static bool LaserST_R_ToLD5_A = false;
        public static bool LaserST_R_ToLD6_A = false;
        public static bool LaserST_R_ToLD7_A = false;
        public static bool LaserST_R_ToLD8_A = false;
        public static bool LaserST_R_ToNext_A = false;

        public static bool LaserST_R_Homed = false;
        public static bool LaserST_R_LD1 = false;
        public static bool LaserST_R_LD2 = false;
        public static bool LaserST_R_LD3 = false;
        public static bool LaserST_R_LD4 = false;
        public static bool LaserST_R_LD5 = false;
        public static bool LaserST_R_LD6 = false;
        public static bool LaserST_R_LD7 = false;
        public static bool LaserST_R_LD8 = false;

        public static int LaserST_R_Index = 0;
        public static int LaserST_R_IndexBuf = 0;
        public static int LaserST_R_IndexBuf_A = 0;

        public static bool LaserST_R_Homed_BL = false;
        public static bool LaserST_R_LD1_BL = false;
        public static bool LaserST_R_LD2_BL = false;
        public static bool LaserST_R_LD3_BL = false;
        public static bool LaserST_R_LD4_BL = false;
        public static bool LaserST_R_LD5_BL = false;
        public static bool LaserST_R_LD6_BL = false;
        public static bool LaserST_R_LD7_BL = false;
        public static bool LaserST_R_LD8_BL = false;
        #endregion

        #region ULDTR_1_Z
        public static bool ULDTR_1_Z_ToStop = false;
        public static bool ULDTR_1_Z_ToHome = false;
        public static bool ULDTR_1_Z_ToGet = false;
        public static bool ULDTR_1_Z_ToPut = false;
        public static bool ULDTR_1_Z_ToALG = false;
        public static bool ULDTR_1_Z_ToFilmRemove = false;
        public static bool ULDTR_1_Z_ToWait = false;
        public static bool ULDTR_1_Z_ToNGPut = false;

        public static bool ULDTR_1_Z_ToHome_A = false;
        public static bool ULDTR_1_Z_ToGet_A = false;
        public static bool ULDTR_1_Z_ToPut_A = false;
        public static bool ULDTR_1_Z_ToALG_A = false;
        public static bool ULDTR_1_Z_ToFilmRemove_A = false;
        public static bool ULDTR_1_Z_ToWait_A = false;
        public static bool ULDTR_1_Z_ToNGPut_A = false;

        public static bool ULDTR_1_Z_Homed = false;
        public static bool ULDTR_1_Z_Get = false;
        public static bool ULDTR_1_Z_Put = false;
        public static bool ULDTR_1_Z_ALG = false;
        public static bool ULDTR_1_Z_FilmRemove = false;
        public static bool ULDTR_1_Z_Wait = false;
        public static bool ULDTR_1_Z_NGPut = false;

        public static bool ULDTR_1_Z_Homed_BL = false;
        public static bool ULDTR_1_Z_Get_BL = false;
        public static bool ULDTR_1_Z_Put_BL = false;
        public static bool ULDTR_1_Z_ALG_BL = false;
        public static bool ULDTR_1_Z_FilmRemove_BL = false;
        public static bool ULDTR_1_Z_Wait_BL = false;
        public static bool ULDTR_1_Z_NGPut_BL = false;

        public static bool ULDTR_1_ZAtWait = false;
        #endregion

        #region ULDTR_1_R
        public static bool ULDTR_1_R_AllowMove = false;
        public static bool ULDTR_1_R_ToStop = false;
        public static bool ULDTR_1_R_ToHome = false;
        public static bool ULDTR_1_R_ToLD = false;
        public static bool ULDTR_1_R_ToULD_0 = false;
        public static bool ULDTR_1_R_ToULD_90R = false;
        public static bool ULDTR_1_R_ToULD_180R = false;
        public static bool ULDTR_1_R_ToULD_90F = false;

        public static bool ULDTR_1_R_ToHome_A = false;
        public static bool ULDTR_1_R_ToLD_A = false;
        public static bool ULDTR_1_R_ToULD_0_A = false;
        public static bool ULDTR_1_R_ToULD_90R_A = false;
        public static bool ULDTR_1_R_ToULD_180R_A = false;
        public static bool ULDTR_1_R_ToULD_90F_A = false;

        public static bool ULDTR_1_R_Homed = false;
        public static bool ULDTR_1_R_LD = false;
        public static bool ULDTR_1_R_ULD_0 = false;
        public static bool ULDTR_1_R_ULD_90R = false;
        public static bool ULDTR_1_R_ULD_180R = false;
        public static bool ULDTR_1_R_ULD_90F = false;

        public static bool ULDTR_1_R_Homed_BL = false;
        public static bool ULDTR_1_R_LD_BL = false;
        public static bool ULDTR_1_R_ULD_0_BL = false;
        public static bool ULDTR_1_R_ULD_90R_BL = false;
        public static bool ULDTR_1_R_ULD_180R_BL = false;
        public static bool ULDTR_1_R_ULD_90F_BL = false;
        public static double ULDTR_1_ULD_Offset = 0;
        #endregion

        #region ULDTR_1_Clamp
        public static bool ULDTR_1_Clamp_ToClose = false;
        public static bool ULDTR_1_Clamp_ToOpen = false;
        public static bool ULDTR_1_Clamp_ToHome = false;
        public static bool ULDTR_1_Clamp_ToStop = false;
        public static bool ULDTR_1_Clamp_ToSVON = false;

        public static bool ULDTR_1_Clamp_ToClose_A = false;
        public static bool ULDTR_1_Clamp_ToOpen_A = false;
        public static bool ULDTR_1_Clamp_ToHome_A = false;

        public static bool ULDTR_1_Clamp_Close = false;
        public static bool ULDTR_1_Clamp_Open = false;
        public static bool ULDTR_1_Clamp_Homed = false;
        public static bool ULDTR_1_Clamp_SVON = false;

        public static bool ULDTR_1_Clamp_Close_BL = false;
        public static bool ULDTR_1_Clamp_Open_BL = false;
        public static bool ULDTR_1_Clamp_Homed_BL = false;
        public static bool ULDTR_1_Clamp_SVON_BL = false;
        public static int ULDTR_1_Clamp_TarPos = 0;
        #endregion

        #region ULDTR_2_Z
        public static bool ULDTR_2_Z_ToStop = false;
        public static bool ULDTR_2_Z_ToHome = false;
        public static bool ULDTR_2_Z_ToGet = false;
        public static bool ULDTR_2_Z_ToPut = false;
        public static bool ULDTR_2_Z_ToALG = false;
        public static bool ULDTR_2_Z_ToFilmRemove = false;
        public static bool ULDTR_2_Z_ToWait = false;
        public static bool ULDTR_2_Z_ToNGPut = false;

        public static bool ULDTR_2_Z_ToHome_A = false;
        public static bool ULDTR_2_Z_ToGet_A = false;
        public static bool ULDTR_2_Z_ToPut_A = false;
        public static bool ULDTR_2_Z_ToALG_A = false;
        public static bool ULDTR_2_Z_ToFilmRemove_A = false;
        public static bool ULDTR_2_Z_ToWait_A = false;
        public static bool ULDTR_2_Z_ToNGPut_A = false;

        public static bool ULDTR_2_Z_Homed = false;
        public static bool ULDTR_2_Z_Get = false;
        public static bool ULDTR_2_Z_Put = false;
        public static bool ULDTR_2_Z_ALG = false;
        public static bool ULDTR_2_Z_FilmRemove = false;
        public static bool ULDTR_2_Z_Wait = false;
        public static bool ULDTR_2_Z_NGPut = false;

        public static bool ULDTR_2_Z_Homed_BL = false;
        public static bool ULDTR_2_Z_Get_BL = false;
        public static bool ULDTR_2_Z_Put_BL = false;
        public static bool ULDTR_2_Z_ALG_BL = false;
        public static bool ULDTR_2_Z_FilmRemove_BL = false;
        public static bool ULDTR_2_Z_Wait_BL = false;
        public static bool ULDTR_2_Z_NGPut_BL = false;

        public static bool ULDTR_2_ZAtWait = false;
        #endregion

        #region ULDTR_2_R
        public static bool ULDTR_2_R_AllowMove = false;
        public static bool ULDTR_2_R_ToStop = false;
        public static bool ULDTR_2_R_ToHome = false;
        public static bool ULDTR_2_R_ToLD = false;
        public static bool ULDTR_2_R_ToULD_0 = false;
        public static bool ULDTR_2_R_ToULD_90R = false;
        public static bool ULDTR_2_R_ToULD_180R = false;
        public static bool ULDTR_2_R_ToULD_90F = false;

        public static bool ULDTR_2_R_ToHome_A = false;
        public static bool ULDTR_2_R_ToLD_A = false;
        public static bool ULDTR_2_R_ToULD_0_A = false;
        public static bool ULDTR_2_R_ToULD_90R_A = false;
        public static bool ULDTR_2_R_ToULD_180R_A = false;
        public static bool ULDTR_2_R_ToULD_90F_A = false;

        public static bool ULDTR_2_R_Homed = false;
        public static bool ULDTR_2_R_LD = false;
        public static bool ULDTR_2_R_ULD_0 = false;
        public static bool ULDTR_2_R_ULD_90R = false;
        public static bool ULDTR_2_R_ULD_180R = false;
        public static bool ULDTR_2_R_ULD_90F = false;

        public static bool ULDTR_2_R_Homed_BL = false;
        public static bool ULDTR_2_R_LD_BL = false;
        public static bool ULDTR_2_R_ULD_0_BL = false;
        public static bool ULDTR_2_R_ULD_90R_BL = false;
        public static bool ULDTR_2_R_ULD_180R_BL = false;
        public static bool ULDTR_2_R_ULD_90F_BL = false;
        public static double ULDTR_2_ULD_Offset = 0;
        #endregion

        #region ULDTR_2_Clamp
        public static bool ULDTR_2_Clamp_ToClose = false;
        public static bool ULDTR_2_Clamp_ToOpen = false;
        public static bool ULDTR_2_Clamp_ToHome = false;
        public static bool ULDTR_2_Clamp_ToStop = false;
        public static bool ULDTR_2_Clamp_ToSVON = false;

        public static bool ULDTR_2_Clamp_ToClose_A = false;
        public static bool ULDTR_2_Clamp_ToOpen_A = false;
        public static bool ULDTR_2_Clamp_ToHome_A = false;

        public static bool ULDTR_2_Clamp_Close = false;
        public static bool ULDTR_2_Clamp_Open = false;
        public static bool ULDTR_2_Clamp_Homed = false;
        public static bool ULDTR_2_Clamp_SVON = false;

        public static bool ULDTR_2_Clamp_Close_BL = false;
        public static bool ULDTR_2_Clamp_Open_BL = false;
        public static bool ULDTR_2_Clamp_Homed_BL = false;
        public static bool ULDTR_2_Clamp_SVON_BL = false;
        public static int ULDTR_2_Clamp_TarPos = 0;
        #endregion

        #region ULDTR_R
        public static bool ULDTR_R_AllowMove = false;
        public static bool ULDTR_R_ToStop = false;
        public static bool ULDTR_R_ToHome = false;
        public static bool ULDTR_R_ToLD = false;
        public static bool ULDTR_R_ToULD = false;
        public static bool ULDTR_R_ToALG = false;

        public static bool ULDTR_R_ToHome_A = false;
        public static bool ULDTR_R_ToLD_A = false;
        public static bool ULDTR_R_ToULD_A = false;
        public static bool ULDTR_R_ToALG_A = false;

        public static bool ULDTR_R_Homed = false;
        public static bool ULDTR_R_LD = false;
        public static bool ULDTR_R_ULD = false;
        public static bool ULDTR_R_ALG = false;

        public static bool ULDTR_R_Homed_BL = false;
        public static bool ULDTR_R_LD_BL = false;
        public static bool ULDTR_R_ULD_BL = false;
        public static bool ULDTR_R_ALG_BL = false;
        #endregion

        #region ULDTR_CCD
        public static bool ULDTR_CCD_ToStop = false;
        public static bool ULDTR_CCD_ToHome = false;
        public static bool ULDTR_CCD_ToALG = false;

        public static bool ULDTR_CCD_ToHome_A = false;
        public static bool ULDTR_CCD_ToALG_A = false;

        public static bool ULDTR_CCD_Homed = false;
        public static bool ULDTR_CCD_ALG = false;

        public static bool ULDTR_CCD_Homed_BL = false;
        public static bool ULDTR_CCD_ALG_BL = false;
        #endregion

        #region LaserST_CCD1
        public static bool LaserST_CCD1_ToStop = false;
        public static bool LaserST_CCD1_ToHome = false;
        public static bool LaserST_CCD1_ToALG = false;

        public static bool LaserST_CCD1_ToHome_A = false;
        public static bool LaserST_CCD1_ToALG_A = false;

        public static bool LaserST_CCD1_Homed = false;
        public static bool LaserST_CCD1_ALG = false;

        public static bool LaserST_CCD1_Homed_BL = false;
        public static bool LaserST_CCD1_ALG_BL = false;
        #endregion

        #region LaserST_CCD2
        public static bool LaserST_CCD2_ToStop = false;
        public static bool LaserST_CCD2_ToHome = false;
        public static bool LaserST_CCD2_ToALG = false;

        public static bool LaserST_CCD2_ToHome_A = false;
        public static bool LaserST_CCD2_ToALG_A = false;

        public static bool LaserST_CCD2_Homed = false;
        public static bool LaserST_CCD2_ALG = false;

        public static bool LaserST_CCD2_Homed_BL = false;
        public static bool LaserST_CCD2_ALG_BL = false;
        #endregion

        #region LaserST_CCD3
        public static bool LaserST_CCD3_ToStop = false;
        public static bool LaserST_CCD3_ToHome = false;
        public static bool LaserST_CCD3_ToALG = false;

        public static bool LaserST_CCD3_ToHome_A = false;
        public static bool LaserST_CCD3_ToALG_A = false;

        public static bool LaserST_CCD3_Homed = false;
        public static bool LaserST_CCD3_ALG = false;

        public static bool LaserST_CCD3_Homed_BL = false;
        public static bool LaserST_CCD3_ALG_BL = false;

        public static double LaserST_CCD3_ALGOffset = 0;
        #endregion

        #region ULDST
        public static bool ULDST_AllowHome = false;
        public static bool ULDST_X_AllowMove = false;
        public static bool ULDST_Y_AllowMove = false;
        public static bool ULDST_ToStop = false;
        public static bool ULDST_ToHome = false;
        public static bool ULDST_ToLD = false;
        public static bool ULDST_ToULD = false;
        public static bool ULDST_ToALG1 = false;
        public static bool ULDST_ToALG2 = false;
        public static bool ULDST_ToOkDieLD = false;
        public static bool ULDST_ToNGDieLD = false;
        public static bool ULDST_ToFilmRemove = false;
        public static bool ULDST_ToWait = false;

        public static bool ULDST_ToHome_A = false;
        public static bool ULDST_ToLD_A = false;
        public static bool ULDST_ToULD_A = false;
        public static bool ULDST_ToALG1_A = false;
        public static bool ULDST_ToALG2_A = false;
        public static bool ULDST_ToOkDieLD_A = false;
        public static bool ULDST_ToNGDieLD_A = false;
        public static bool ULDST_ToFilmRemove_A = false;
        public static bool ULDST_ToWait_A = false;

        public static bool ULDST_X_ToLD_A = false;
        public static bool ULDST_X_ToULD_A = false;
        public static bool ULDST_X_ToALG1_A = false;
        public static bool ULDST_X_ToALG2_A = false;
        public static bool ULDST_X_ToOkDieLD_A = false;
        public static bool ULDST_X_ToNGDieLD_A = false;
        public static bool ULDST_X_ToFilmRemove_A = false;
        public static bool ULDST_X_ToWait_A = false;

        public static bool ULDST_Y_ToLD_A = false;
        public static bool ULDST_Y_ToULD_A = false;
        public static bool ULDST_Y_ToALG1_A = false;
        public static bool ULDST_Y_ToALG2_A = false;
        public static bool ULDST_Y_ToOkDieLD_A = false;
        public static bool ULDST_Y_ToNGDieLD_A = false;
        public static bool ULDST_Y_ToFilmRemove_A = false;
        public static bool ULDST_Y_ToWait_A = false;

        public static bool ULDST_Homed = false;
        public static bool ULDST_LD = false;
        public static bool ULDST_ULD = false;
        public static bool ULDST_ALG1 = false;
        public static bool ULDST_ALG2 = false;
        public static bool ULDST_OkDieLD = false;
        public static bool ULDST_NGDieLD = false;
        public static bool ULDST_FilmRemove = false;
        public static bool ULDST_Wait = false;

        public static bool ULDST_Homed_BL = false;
        public static bool ULDST_LD_BL = false;
        public static bool ULDST_ULD_BL = false;
        public static bool ULDST_ALG1_BL = false;
        public static bool ULDST_ALG2_BL = false;
        public static bool ULDST_OkDieLD_BL = false;
        public static bool ULDST_NGDieLD_BL = false;
        public static bool ULDST_FilmRemove_BL = false;
        public static bool ULDST_Wait_BL = false;

        public static bool ULDST_X_LD = false;
        public static bool ULDST_X_ULD = false;
        public static bool ULDST_X_ALG1 = false;
        public static bool ULDST_X_ALG2 = false;
        public static bool ULDST_X_OkDieLD = false;
        public static bool ULDST_X_NGDieLD = false;
        public static bool ULDST_X_FilmRemove = false;
        public static bool ULDST_X_Wait = false;
        public static double ULDST_OkLD_X = 0;
        public static double ULDST_NGLD_X = 0;

        public static bool ULDST_Y_LD = false;
        public static bool ULDST_Y_ULD = false;
        public static bool ULDST_Y_ALG1 = false;
        public static bool ULDST_Y_ALG2 = false;
        public static bool ULDST_Y_OkDieLD = false;
        public static bool ULDST_Y_NGDieLD = false;
        public static bool ULDST_Y_FilmRemove = false;
        public static bool ULDST_Y_Wait = false;
        public static double ULDST_OkLD_Y = 0;
        public static double ULDST_NGLD_Y = 0;
        #endregion

        #region ULDST_Ext
        public static bool ULDST_Ext_AllowMove = false;
        public static bool ULDST_Ext_ToStop = false;
        public static bool ULDST_Ext_ToHome = false;
        public static bool ULDST_Ext_ToInLD = false;
        public static bool ULDST_Ext_ToInULD = false;
        public static bool ULDST_Ext_ToInWait = false;
        public static bool ULDST_Ext_ToOutLD = false;
        public static bool ULDST_Ext_ToOutULD = false;
        public static bool ULDST_Ext_ToOutWait = false;
        public static bool ULDST_Ext_ToDieLD = false;
        public static bool ULDST_Ext_ToOutSafe = false;

        public static bool ULDST_Ext_ToHome_A = false;
        public static bool ULDST_Ext_ToInLD_A = false;
        public static bool ULDST_Ext_ToInULD_A = false;
        public static bool ULDST_Ext_ToInWait_A = false;
        public static bool ULDST_Ext_ToOutLD_A = false;
        public static bool ULDST_Ext_ToOutULD_A = false;
        public static bool ULDST_Ext_ToOutWait_A = false;
        public static bool ULDST_Ext_ToDieLD_A = false;
        public static bool ULDST_Ext_ToOutSafe_A = false;

        public static bool ULDST_Ext_Homed = false;
        public static bool ULDST_Ext_InLD = false;
        public static bool ULDST_Ext_InULD = false;
        public static bool ULDST_Ext_InWait = false;
        public static bool ULDST_Ext_OutLD = false;
        public static bool ULDST_Ext_OutULD = false;
        public static bool ULDST_Ext_OutWait = false;
        public static bool ULDST_Ext_DieLD = false;
        public static bool ULDST_Ext_OutSafe = false;

        public static bool ULDST_Ext_Homed_BL = false;
        public static bool ULDST_Ext_InLD_BL = false;
        public static bool ULDST_Ext_InULD_BL = false;
        public static bool ULDST_Ext_InWait_BL = false;
        public static bool ULDST_Ext_OutLD_BL = false;
        public static bool ULDST_Ext_OutULD_BL = false;
        public static bool ULDST_Ext_OutWait_BL = false;
        public static bool ULDST_Ext_DieLD_BL = false;
        public static bool ULDST_Ext_OutSafe_BL = false;

        public static double ULDST_Ext_DieLDPos = 0;
        public static double ULDST_Ext_DieLDPosTab = 0;
        #endregion

        #region ULDST_CCD
        public static bool ULDST_CCD_ToStop = false;
        public static bool ULDST_CCD_ToHome = false;
        public static bool ULDST_CCD_ToALG = false;

        public static bool ULDST_CCD_ToHome_A = false;
        public static bool ULDST_CCD_ToALG_A = false;

        public static bool ULDST_CCD_Homed = false;
        public static bool ULDST_CCD_ALG = false;

        public static bool ULDST_CCD_Homed_BL = false;
        public static bool ULDST_CCD_ALG_BL = false;
        #endregion

        #region 功能选择
        /// <summary>
        /// 倒膜平台读码Pass
        /// </summary>
        public static bool ExcSTCodeReadPass = false;
        /// <summary>
        /// 倒膜平台初对位Pass
        /// </summary>
        public static bool ExcSTPreAlignPass = false;
        /// <summary>
        /// 倒膜Pass
        /// </summary>
        public static bool ExchangePass = false;
        /// <summary>
        /// 倒膜结果检查Pass
        /// </summary>
        public static bool ExcInspPass = false;
        /// <summary>
        /// 挑拣Pass
        /// </summary>
        public static bool SortPass = false;
        /// <summary>
        /// 挑拣平台初对位Pass
        /// </summary>
        public static bool SortSTPreAlignPass = false;
        /// <summary>
        /// 挑拣平台精对位Pass
        /// </summary>
        public static bool SortSTFinalAlignPass = false;
        /// <summary>
        /// 挑拣平台水平检查Pass
        /// </summary>
        public static bool SortSTFrameCheckPass = false;
        /// <summary>
        /// 载入移载1Pass
        /// </summary>
        public static bool LDTR_1_Pass = false;
        /// <summary>
        /// 载入移载2Pass
        /// </summary>
        public static bool LDTR_2_Pass = false;
        /// <summary>
        /// 镭射对位Pass
        /// </summary>
        public static bool LaserPreAlignPass = false;
        /// <summary>
        /// 镭射Pass
        /// </summary>
        public static bool LaserPass = false;
        /// <summary>
        /// 镭射结果检查抽检Enable
        /// </summary>
        public static bool LaserSpotInspEnable = false;
        /// <summary>
        /// 镭射结果检查Pass
        /// </summary>
        public static bool LaserInspPass = false;
        /// <summary>
        /// 镭射ID自动获取Pass
        /// </summary>
        public static bool LaserIDAutoGetPass = false;
        /// <summary>
        /// 镭射ID自动获取内容
        /// </summary>
        public static string LaserID_AutoGet = "";
        /// <summary>
        /// 镭射ID手动输入内容
        /// </summary>
        public static string LaserID_Manual = "";
        /// <summary>
        /// 镭射ID手动输入LINE1内容
        /// </summary>
        public static string LaserIDLine1_Manual = "";
        /// <summary>
        /// 镭射ID手动输入LINE2内容
        /// </summary>
        public static string LaserIDLine2_Manual = "";
        /// <summary>
        /// 镭射ID手动输入LINE3内容
        /// </summary>
        public static string LaserIDLine3_Manual = "";
        /// <summary>
        /// 镭射ID手动输入LINE4内容
        /// </summary>
        public static string LaserIDLine4_Manual = "";
        /// <summary>
        /// 镭射平台1Pass
        /// </summary>
        public static bool LaserST_1_Pass = false;
        /// <summary>
        /// 镭射平台2Pass
        /// </summary>
        public static bool LaserST_2_Pass = false;
        /// <summary>
        /// 镭射平台3Pass
        /// </summary>
        public static bool LaserST_3_Pass = false;
        /// <summary>
        /// 镭射平台4Pass
        /// </summary>
        public static bool LaserST_4_Pass = false;
        /// <summary>
        /// 镭射平台5Pass
        /// </summary>
        public static bool LaserST_5_Pass = false;
        /// <summary>
        /// 镭射平台6Pass
        /// </summary>
        public static bool LaserST_6_Pass = false;
        /// <summary>
        /// 镭射平台7Pass
        /// </summary>
        public static bool LaserST_7_Pass = false;
        /// <summary>
        /// 镭射平台8Pass
        /// </summary>
        public static bool LaserST_8_Pass = false;
        /// <summary>
        /// 载出移载1Pass
        /// </summary>
        public static bool ULDTR_1_Pass = false;
        /// <summary>
        /// 载出移载2Pass
        /// </summary>
        public static bool ULDTR_2_Pass = false;
        /// <summary>
        /// 黄膜去除功能Pass
        /// </summary>
        public static bool FilmRemovePass = false;
        /// <summary>
        /// 载出平台初对位Pass
        /// </summary>
        public static bool ULDSTPreAlignPass = false;
        /// <summary>
        /// 载出平台精对位Pass
        /// </summary>
        public static bool ULDSTFinalAlignPass = false;
        #endregion

        #region 半自动
        public static bool LaserAlignSingalAuto = false;

        public static bool LaserSingalAuto = false;

        public static bool LaserInspSingalAuto = false;

        public static bool ExcSTFlatnesCheck = false;

        public static bool LaserSTFlatnesCheck = false;

        public static bool LDTR1_ToNext = false;
        public static bool LDTR2_ToNext = false;
        public static bool ULDTR1_ToNext = false;
        public static bool ULDTR2_ToNext = false;

        public static bool Insp1_ToNext = false;
        public static bool Insp2_ToNext = false;
        public static bool Insp3_ToNext = false;
        public static bool Insp4_ToNext = false;  




        #endregion

        #region 报警

        public static bool SetProgramFail = false;
        public static bool SetMarkingParameterFail = false;
        public static bool SetBlockFail = false;

        public static bool LDTR1_GetFail = false;
        public static bool LDTR2_GetFail = false;
        public static bool LDTR1_PutFail = false;
        public static bool LDTR2_PutFail = false;

        public static bool ULDTR1_GetFail = false;
        public static bool ULDTR2_GetFail = false;
        public static bool ULDTR1_PutFail = false;
        public static bool ULDTR2_PutFail = false;

        public static bool ULDSTNGTrayEmptyError = false;
        public static bool ULDSTNGTrayFullError = false;
        public static bool ULDSTNGTrayWaferIDError = false;
        #endregion
    }
}
